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

Invalid Swagger spec generated: Parameter Object must contain one of the following fields: content, schema #5024

Open
seanoAvani opened this issue Nov 15, 2024 · 0 comments

Comments

@seanoAvani
Copy link

Hi,

I am getting validation errors in https://editor-next.swagger.io/ and also importing to Azure API management.

I have to manually fix the yaml for parameter type in: header as they dont contain the schema object.

If i change:

        - type: string
          name: TenantId
          in: header
          required: true
          description: The TenantId
          default: Google

to

        - name: TenantId
          in: header
          schema:
            type: string
          required: true
          description: The TenantId

The spec is valid.

Full Example:

x-generator: NSwag v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))
openapi: 3.0.0
info:
  title: Example WebApi
  version: v1
servers:
  - url: https://localhost
paths:
  /ComparisonOperators:
    get:
      tags:
        - ComparisonOperators
      operationId: ComparisonOperators_Get
      parameters:
        - name: PageNumber
          in: query
          schema:
            type: integer
            format: int32
          x-position: 1
        - name: PageSize
          in: query
          schema:
            type: integer
            format: int32
          x-position: 2
        - type: string
          name: TenantId
          in: header
          required: true
          description: The TenantId
          default: Google
      responses:
        '200':
          description: ''
          content:
            application/json:

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