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

Try to use components in schema #1

Open
maksbotan opened this issue Aug 4, 2020 · 1 comment
Open

Try to use components in schema #1

maksbotan opened this issue Aug 4, 2020 · 1 comment

Comments

@maksbotan
Copy link
Collaborator

OpenAPI 3 has components field, where one can put request bodies, params, headers, responses and so on and reuse them across operations.

Would it make sense to try to extract common requests, params etc in servant-swagger? For example, if RequestBody combinator is applied to sub-api with multiple Verb's, we could store the spec for it in components.

@normenmueller
Copy link

I second this proposal.

For example, I'd like to use $refs to #/components/parameters, #/components/schema, and #components/responses:

paths:
  /systems:
    get:
      summary: "Get status and properties of the system."
      tags:
        - System
      parameters:
        - $ref: '#/components/parameters/fields'
      responses:
        '200':
          description: The status and properties of the system.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sys'
        '500':
          $ref: '#/components/responses/500'

As far as I can judge, at the moment servant-openapi3 "only" support #/components/schemas, the rest is inlined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants