Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to append to a potentially non-existing array? #63

Open
ralfhandl opened this issue Sep 25, 2024 · 0 comments
Open

How to append to a potentially non-existing array? #63

ralfhandl opened this issue Sep 25, 2024 · 0 comments
Labels
question Further information is requested
Milestone

Comments

@ralfhandl
Copy link
Contributor

The Traits Example shows how to add query parameters for paging to an operation, which in this simple form would only work if the operation does not already have parameters.

How would this be extended to a less trivial case where operations may already have parameters?

openapi: 3.1.0
info:
  title: API with a paged collection
  version: 1.0.0
paths:
  /items:
    get:
      x-oai-traits: ['paged']
      responses:
        200:
          description: OK
  /items/{id}/subitems:
    get:
      x-oai-traits: ['paged']
      parameters:
        - name: id
          in: path
          required: true
      responses:
        200:
          description: OK

Would I have to specify an action for operation objects without parameters and actions for operation objects with parameters?

overlay: 1.0.0
info:
  title: Apply Traits
  version: 1.0.0
actions:
  - target: $.paths.*.get[[email protected] && [email protected]]
    update:
      parameters:
        - name: top
          in: query
          # ...
        - name: skip
          in: query
          # ...
  - target: $.paths.*.get[[email protected]].parameters
    update:
      name: top
      in: query
      # ...
  - target: $.paths.*.get[[email protected]].parameters
    update:
      name: skip
      in: query
      # ...
@ralfhandl ralfhandl added the question Further information is requested label Sep 25, 2024
@ralfhandl ralfhandl added this to the Release 2.0 milestone Oct 9, 2024
@ralfhandl ralfhandl modified the milestones: Release 2.0, Release 1.0 Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant