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

Generated open api missing schema in path/query parameter #1767

Closed
YannickTeKulve opened this issue Feb 21, 2024 · 1 comment
Closed

Generated open api missing schema in path/query parameter #1767

YannickTeKulve opened this issue Feb 21, 2024 · 1 comment

Comments

@YannickTeKulve
Copy link

YannickTeKulve commented Feb 21, 2024

Describe the bug
The open api spec states: A parameter MUST contain either a schema property, or a content property, but not both.
See also https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md
and this example: https://github.com/OAI/OpenAPI-Specification/blob/19765c1eff1f733802b1c6f14cf8a073fb7a5b25/examples/v3.0/petstore-expanded.yaml#L113C11-L116C1

But when generating path or query parameters these are missing

To Reproduce
The following comments:

// @Router       /foo/{name} [put]
// @Param        name path string true "The name"

Generates:

/foo/{name}:
    put:
      parameters:
      - description: The name
        in: path
        name: name
        required: true
        type: string
      responses: {}

Expected behavior
Should be:

  /foo/{name}:
    put:
      parameters:
      - description: The name
        in: path
        name: name
        required: true
        schema:
          type: string
      responses: {}`

Your swag version
v1.16.3

Your go version
1.21

Desktop (please complete the following information):

  • OS: sonoma 14.3

Additional context
Also for json

@YannickTeKulve
Copy link
Author

Close: v2 vs v3 openapi spec

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

1 participant