-
Notifications
You must be signed in to change notification settings - Fork 764
Closed
Description
I fall down into the same problem as described in swagger-api/swagger-ui#1723 I try to debug it and I think the problem is with swagger-js not the ui. Here I created simple junit test (in resolver.js):
it('base model properties', function(done) {
var api = new Resolver();
var spec = {
swagger:'2.0',
info:{
},
host:"localhost:9000",
schemes:[
"http"
],
basePath:"/2.0",
paths:{
'/':{
get:{
responses:{
"200":{
description:"Pets",
schema:{
"$ref":"#/definitions/Pet"
}
}
},
parameters:[
]
}
}
},
definitions:{
Cat:{
allOf: [
{
"$ref": "#/definitions/Pet"
},
{
type: "object",
properties:{
size:{
type: "number"
}
}
}
]
},
Pet:{
type: "object",
properties:{
color:{
"$ref":"#/definitions/Color"
}
}
},
Color:{
"type": "string"
}
}
};
api.resolve(spec, 'http://localhost:8000/v2/swagger.json', function (spec, unresolved) {
expect(spec.definitions.Pet.properties.color['$ref']).toBe('#/definitions/Color');
expect(spec.definitions.Cat.properties.color['$ref']).toBe('#/definitions/Color');
done();
});
});
It fails because method as the result returns values like: "http://localhost:8000/v2/swagger.json#/definitions/Color".
I'm expecting here to get "#/definitions/Color" even if it is used by "inline" object. Is it right assumption?
Metadata
Metadata
Assignees
Labels
No labels