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

References outside components and paths are not resolved. #309

Open
VShingala opened this issue Oct 22, 2020 · 1 comment · May be fixed by #354
Open

References outside components and paths are not resolved. #309

VShingala opened this issue Oct 22, 2020 · 1 comment · May be fixed by #354
Labels
feature New feature request, accepted for probable development ref-object Issues concernig resolution of $ref under OpenAPI spec.

Comments

@VShingala
Copy link
Member

When OpenAPI spec contains $ref in it which is not under components or path, the generated collection fails to include information regarding it.

for example, In below example entire operation under path /pets/{petId} is not present in generated collection.

openapi: "3.0.0"
info:
  version: 1.0.0
  title: Swagger Petstore
  license:
    name: MIT
servers:
  - url: http://petstore.swagger.io/v1
paths:
  /pets:
    get:
      summary: List all pets
      operationId: listPets
      tags:
        - pets
      parameters:
        - name: limit
          in: query
          description: How many items to return at one time (max 100)
          required: false
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: A paged array of pets
          headers:
            x-next:
              description: A link to the next page of responses
              schema:
                type: string
          content:
            application/json:    
              schema:
                $ref: "#/components/schemas/Pets"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
    post:
      summary: Create a pet
      operationId: createPets
      tags:
        - pets
      responses:
        '201':
          description: Null response
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /pets/{petId}:
    $ref: "#/x-operations/getAPet"
components:
  schemas:
    Pet:
      type: object
      required:
        - id
        - name
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        tag:
          type: string
    Pets:
      type: array
      items:
        $ref: "#/components/schemas/Pet"
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
x-operations:
  getAPet:
    get:
      summary: Info for a specific pet
      operationId: showPetById
      tags:
        - pets
      parameters:
        - name: petId
          in: path
          required: true
          description: The id of the pet to retrieve
          schema:
            type: string
      responses:
        '200':
          description: Expected response to a valid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pet"
        default:
          description: unexpected error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
@VShingala VShingala added feature New feature request, accepted for probable development ref-object Issues concernig resolution of $ref under OpenAPI spec. bug Something isn't working and removed feature New feature request, accepted for probable development bug Something isn't working labels Oct 22, 2020
@arlemi
Copy link
Collaborator

arlemi commented Jul 1, 2021

Reporting on behalf of a user.

Facing this issue with the following API spec: https://github.com/tru-ID/api-definitions/blob/main/specs/openapi.v1.yaml.

Also, references aren't being found although they do exist (see UUID).
Screen Shot 2021-07-01 at 09 27 50
The body for PhoneCheck creation is not being found. Again, potentially another reference problem? https://github.com/tru-ID/api-definitions/blob/main/specs/models/check/CheckResourceModels.v1.yaml#L23
Screen Shot 2021-07-01 at 09 28 05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request, accepted for probable development ref-object Issues concernig resolution of $ref under OpenAPI spec.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants