Skip to content

resolveFully doesn't resolve nested references or normal references for Callbacks and its PathItem usecase #1579

Closed
@mma5997

Description

@mma5997

OpenAPI version : 3.0.0
Swagger-parser 2.0.26

I am using the resolveFully parse option as mentioned here but seems its not working for most of my usecases WHICH INVOLVE CALLBACKS AND PATH ITEM FOR CALLBACKS

My use case INVOLVING CALLBACKS AND ITS PATH ITEM INSIDE IT are like below

  1. Resolving nested schemas that might be referenced from "#components/schemas/"
  2. Resolving requestBody referenced from "#components/requestBodies/"
  3. Resolving response referenced from "#components/responses/"
  4. Resolving callback referenced from "#components/callbacks/"
  5. Combination of point 2,1
  6. Combination of point 3,1
  7. Combination of point 4,3,21

Looks like an issue. Technically it should resolve the local references and place it as the inline definitions in the OpenAPI document java object, if I am not mistaken reading the mentioned here. And it does resolve for other normal PathItems but for not for callbacks specific use-cases mentioned 1-7.

Please refer the below OAS3 spec :

openapi: 3.0.0
info:
  version: '1.0'
  title: simple subscription service
  description: subscription service
servers:
  - url: 'http://localhost:8085/'
paths:
  /subscriptions:
    post:
      description: creates a new subscription
      operationId: createSubscription
      parameters:
        - $ref: '#/components/parameters/key'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Subscription'
      responses:
        '201':
          $ref: '#/components/responses/SubscriptionSuccess'
        '400':
          $ref: '#/components/responses/respError'
        '500':
          $ref: '#/components/responses/respError'
      callbacks:
        notification:
          $ref: '#/components/callbacks/Notification'
components:
  callbacks:
    Notification:
      'http://localhost:8099/callback/endpoint':
        post:
          requestBody:
            $ref: '#/components/requestBodies/Notification'
          responses:
            '200':
              description: Your server returns this code if it accepts the callback
  responses:
    SubscriptionSuccess:
      description: Subscription
      headers:
        id:
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Subscription'
    respError:
      description: generic response for errors
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Errors'
  requestBodies:
    Notification:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Notification'
      description: Notification message when event has happened
      required: true
  parameters:
    key:
      description: consumer key
      in: header
      name: API-key
      required: true
      schema:
        type: string
  schemas:
    Notification:
      type: object
      properties:
        message:
          type: string
        id:
          type: string
        sender:
          type: string
    myObject:
      type: object
      properties:
        myName:
          type: string
        myAge:
          type: integer
          format: int32
    Subscription:
      type: object
      properties:
        listOfNames:
          type: array
          items:
            $ref: '#/components/schemas/myObject'
        date:
          type: string
          format: date
        limit:
          type: integer
          format: int32
    Errors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    Error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        traceId:
          type: string
        status:
          type: number

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions