swagger-editor: Getting undefined when giving reference to definition in response of path.

  • Version: Online Swagger Editor
  • Browser/OS: Browser- Chrome, OS - Windows 10

Hello, I am getting am issue from last week. I am creating documentation for my project. I am using Swagger Editor online. I have some definitions which are interrelated. Means one definition has reference of other definition. Then the response of the path has reference of the definition. But when I take a look at it in demo UI which is shown in the editor, the reference shows undefined. I have given one reference code as example . Please take a look at it in the online editor. You can see that under getUserList list in response the user definition is shown as undefined. I guess this issue is because I have references in both definitions. If I remove the userGroup reference from the user definition, I am able to see user in response. This issue wasn’t there a week before. Is anything changed ? Am I suppose to make any other changes to make it work. Please look into this issue because it is a major component of my documentation. Let me know if you need anymore details. Thankyou.

Yaml code

swagger: '2.0'
info:
  title: REST API
  description: REST API Documentation
  version: '1.0'
host: 'admin.sd.net:81'
schemes:
  - http
  - https
produces:
  - application/json
paths:
  /getUserList:
    get:
      summary: Get User List
      description: Get User List
      parameters:
        - name: currentId
          in: query
          description: >-
            Provide current Id
          required: false
          type: integer
      tags:
        - User
      responses:
        '200':
          description: Retrieval successful
          schema:
            type: array
            items:
              $ref: '#/definitions/user'
        default:
          description: Unexpected error
definitions:
  userGroup:
    type: object
    properties:
      id:
        type: integer
      createdBy:
        type: integer
      createdOn:
        type: string
        format: date
      modifiedBy:
        type: integer
      modifiedOn:
        type: string
        format: date
      state:
        type: integer
      name:
        type: string
      description:
        type: string
      users:
        $ref: '#/definitions/user'
      createdByUser:
        type: string
      modifiedByUser:
        type: string
  user:
    type: object
    properties:
      id:
        type: integer
      createdBy:
        type: integer
      createdOn:
        type: string
        format: date
      modifiedBy:
        type: integer
      modifiedOn:
        type: string
        format: date
      state:
        type: integer
      firstName:
        type: string
      lastName:
        type: string
      emailAddress:
        type: string
      users:
        $ref: '#/definitions/userGroup'  

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 17 (6 by maintainers)

Most upvoted comments

I am getting same issue.

ref1 1

You’ll see a fix shortly