Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Direct references are not resolved #50

Closed
yanzacheus opened this issue Jun 20, 2016 · 1 comment
Closed

Direct references are not resolved #50

yanzacheus opened this issue Jun 20, 2016 · 1 comment
Labels

Comments

@yanzacheus
Copy link

Hello and thanks for the project !

I have a swagger specification with direct references in the response part.
For example :

          "responses": {
          "200": {
            "$ref": "#/responses/ok_myres"
          },
          "400": {
            "$ref": "#/responses/common_400"
          },

ok_myres contains schemas and examples, common_400 only contains a description like that:

    "common_400": {
      "description": "Bad request. Invalid request body or parameters."
    },

It works with swagger-jsdoc and swagger-editor, but I have nothing displayed in the angular-swagger-ui directive.
To make it work, it was necessary to add this code :

                    if (response['$ref']) {
                        response = swaggerModel.resolveReference(swagger, response);
                    }

here in your code for the "ok_myres" reference: https://github.com/Orange-OpenSource/angular-swagger-ui/blob/master/src/scripts/swagger-parser.js#L227

and for the "common_400" reference, this code :
operation.responses[code] = response;
here in your code : https://github.com/Orange-OpenSource/angular-swagger-ui/blob/master/src/scripts/swagger-parser.js#L251

Is it normal ? Do I miss something ? Thanks.

@mathieuales
Copy link
Collaborator

Hi !

Will be fixed in next release

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

No branches or pull requests

2 participants