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

Referenced responses are not rendered #1078

Closed
mbaumgartl opened this issue Mar 26, 2015 · 7 comments
Closed

Referenced responses are not rendered #1078

mbaumgartl opened this issue Mar 26, 2015 · 7 comments

Comments

@mbaumgartl
Copy link

I define some common responses and want to reference them in path endpoint(s):

swagger: "2.0"

info:
  title: Sample API
  version: 0.0.1

responses:
  ForbiddenError: # 403
    description: Access denied - additional privileges/rights required to retrieve item
    schema:
      $ref: '#/definitions/Error'
  NotFoundError: # 404
    description: Item not found
    schema:
      $ref: '#/definitions/Error'
  GeneralError: # 500
    description: Unrecoverable error - something really bad happened :-(
    schema:
      $ref: '#/definitions/Error'

paths:
  /article/{articleId}:
    get:
      description: Retrieve single article
      parameters:
        - name: articleId
          in: path
          required: true
          type: integer
          format: int64
      responses:
        200:
          description: Article
          schema:
            type: object
        403:
          $ref: '#/responses/ForbiddenError'
        404:
          $ref: '#/responses/NotFoundError'
        500:
          $ref: '#/responses/GeneralError'

definitions:
  Error:
    type: object
    properties:
      message:
        type: string

The editor renders referenced responses while Swagger-UI doesn't.

@webron webron added this to the v2.1-M2 milestone Mar 26, 2015
@mohsen1
Copy link
Contributor

mohsen1 commented Mar 26, 2015

This is probably fixed by the new swagger-js issue. I'll confirm it today

@fehguy
Copy link
Contributor

fehguy commented Mar 26, 2015

let's add a test around this and close it after verification

@mohsen1
Copy link
Contributor

mohsen1 commented Mar 27, 2015

Fixed in develop_2.0 branch at 3de0b36

screen shot 2015-03-26 at 5 22 25 pm

@mohsen1 mohsen1 closed this as completed Mar 27, 2015
@mbaumgartl
Copy link
Author

@mohsen1: Sorry, but I don't see the issue fixed. Neither description nor model is rendered for referenced responses. I opened this issue because I had the same output (I should have attached a screenshot).

@mohsen1
Copy link
Contributor

mohsen1 commented Mar 27, 2015

hmmm... I see all the responses but apparently their contents are empty. It's an issue in swagger-js. Follow the issue here:

swagger-api/swagger-js#329

@whitlockjc whitlockjc assigned whitlockjc and fehguy and unassigned mohsen1 and whitlockjc Mar 27, 2015
@fehguy
Copy link
Contributor

fehguy commented Mar 28, 2015

confirmed fixed from swagger-api/swagger-js@893eb99
image

@fehguy fehguy closed this as completed Mar 28, 2015
@mbaumgartl
Copy link
Author

Thanks for fixing the issue quickly! +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants