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

url and identifier in the license field are handled incorrectly #1890

Merged

Conversation

bweben
Copy link

@bweben bweben commented Mar 7, 2023

Currently, swagger-parser will error with the following message attribute info.license.identifier is missing when parsing an OpenApi 3.1 document where license.url and license.name is set (see the example document below).
According to the official OpenApi 3.1 schema it must have either the license.url or the license.identifier set but not both.
This PR will fix swagger-parser to work according to the schema.

Example OpenApi 3.1 which currently fails:

openapi: 3.1.0
servers:
  - url: 'http://abc:5555/mypath'
info:
  version: '1.0'
  title: dd
  license:
    name: test
    url: http://example.com
paths:
  /resource1/Id:
    post:
      description: ''
      operationId: postOp
      responses:
        '200':
          description: Successful
        '401':
          description: Access Denied
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/mydefinition'
        required: true
components:
  schemas:
    mydefinition: {}

Link to the OpenApi 3.1 schema:
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#licenseObject

@frantuma frantuma merged commit ec1a3a9 into swagger-api:master Mar 7, 2023
@frantuma
Copy link
Member

frantuma commented Mar 7, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants