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

Schema from shared responses object doesn't resolve for HTTP response codes #606

Closed
hassansin opened this issue Oct 31, 2015 · 0 comments
Closed
Milestone

Comments

@hassansin
Copy link

Test code:

var obj = {
  "swagger" : "2.0",
  "info" : {
    "version" : "0.0.0",
    "title" : "Simple API"
  },
  "responses": {
    "Success": {
      "description": "Success",
      "schema": {
        "type": "string"
      }
    },
    "Error": {
      "description": "Error",
      "schema": {
        "type": "string"
      }
    }
  },
  "paths" : {
    "/" : {
      "get" : {
        "parameters" : [ ],
        "responses" : {
          "200" : {
            "$ref": "#/responses/Success"
          },
          "default": {
            "$ref": "#/responses/Error"
          }
        }
      }
    }
  },
  "definitions" : { }
}

var client = require('swagger-client');
var swagger = new client({
  spec:  obj,
  success: function() {
    console.log(swagger.default.operations.get.responses['200']) //undefined
    console.log(swagger.default.operations.get.responses['default']) //OK
  }
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants