Skip to content

Swagger Parser Does Not Validate Missing Version Field #2169

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

Open
sachin-smartbear opened this issue Apr 3, 2025 · 0 comments
Open

Swagger Parser Does Not Validate Missing Version Field #2169

sachin-smartbear opened this issue Apr 3, 2025 · 0 comments

Comments

@sachin-smartbear
Copy link

According to the OpenAPI/Swagger documentation, the version field in the API definition is mandatory. However, when parsing an API definition that does not include the version field, the Swagger parser does not throw any error or warning.

Steps to Reproduce:

  1. Use the Swagger Parser library to parse the following API definition:
swagger: "2.0"
info:
  title: Test API
  version:  # Missing version field
paths:
  /:
    get:
      summary: List API versions
      produces:
        - application/json
      responses:
        "200":
          description: Successful response
        "300":
          description: Multiple choices response
  /v2:
    get:
      summary: Show API version details
      produces:
        - application/json
      responses:
        "200":
          description: Successful response
        "203":
          description: Non-authoritative information
consumes:
  - application/json
  1. Observe that the parser does not report any validation errors or warnings.

Expected Behavior:
The parser should throw an error or at least a warning indicating that the version field is missing since it is mandatory.

Actual Behavior:
the missing version field in info should trigger a validation error, but it does not.

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