Closed MrWako closed 8 years ago
allOf
is not supported for validation at the moment due to some continued work on the enjoi
module.
You can perform the same definition (from your example) with:
"petInput": {
"$ref": "pet"
}
Also, in your other referenced schema, you are missing the type
attribute (which should be object
). The swagger examples are wrong as well I might add.
Thanks for your patience.
great, thanks for the update - I also submitted an issue regarding these examples to the swagger-spec project as I would be good if the examples were accurate.
Is this an issue with the enjoi module then? Or in swaggerize-*
somewhere? Running into this now as well, and with allOf
being a good way to DRY, it's a shame to not be able to use it...
Following the enjoi
docs - https://github.com/tlivings/enjoi#schema-support, allOf
support got released as part of one of the recent versions.
I am waiting for a new version publish of the generator-swaggerize
, that includes my change of enjoi
version upgrade. Will test this out as soon as the new generator gets published.
https://github.com/krakenjs/generator-swaggerize/blob/master/app/templates/_model.js#L7
models
template generator is expecting properties
as opposed to the possibilities of allOf
etc. I will work on a PR for addressing this.
This feature would be much appreciated.
Consider skipping generating of allOf
models for now with a console warning. It would allow the rest of models to be generated.
This section can be added to your pets.json tests
"Pets": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
},
"Paging": {
"properties": {
"totalItems": {
"type": "integer"
},
"totalPages": {
"type": "integer"
},
"pageSize": {
"type": "integer"
},
"currentPage": {
"type": "integer"
}
}
},
"PagedPets": {
"allOf": [
{
"$ref": "#/definitions/Pets"
},
{
"$ref": "#/definitions/Paging"
}
]
},
Please checkout the latest version generator-swaggerize@3.0.0
. This should be resolved.
Hi Folks,
I've been looking at the V2 JSON examples in https://github.com/swagger-api/swagger-spec/tree/master/examples/v2.0/json and using them with the generator has created a few issues that I've tried to breakdown a little. The first is from https://github.com/swagger-api/swagger-spec/blob/master/examples/v2.0/json/petstore-simple.json
Take 2 copies of this file and delete the
"/pets/{id}": { ... }
sections. In one use the definitionin the other use the definition
I find the one with the $ref generates:
node version v0.10.33, yeoman version 1.3.3. Latest version of generator-swaggerize.