Closed bandolir closed 3 years ago
I have the same problem. @bandolir did you find a solution?
Hi,
I made a fork from swashbuckle and I've fixed in that. Sorry I cannot share that cos' it is in our private repository and as you see the answer on the other side it is not a good solution. Just was a temporary solution for us until it get fixed. I've created these tickets for others who are in the same situation like us. If nothing will happen then we have to consider to replace either swashbuckle or ng-openapi-gen in our project.
I've tested this on swagger editor and it does validate:
components:
schemas:
Shape:
type: object
properties:
name:
type: string
Circle:
type: object
allOf:
- "$ref": "#/components/schemas/Shape"
properties:
radius:
type: integer
format: int32
additionalProperties: false
However, the strange thing is that I couldn't find any mention of that 'mixed' form (allOf inside a type: object) in the openapi specifications, nor examples.
I don't currently have much time for new features in ng-openapi-gen. In this case, a PR is welcome.
I think the fix is easy. In https://github.com/cyclosproject/ng-openapi-gen/blob/master/lib/model.ts (line 100) replace
} else if (schema.type === 'object' || !!schema.properties) {
with
}
if (schema.type === 'object' || !!schema.properties) {
Doing so generated the code I expected.
Will try to work on a PR this week...
Pull request created. (needed in build pipeline :0)
Old issue closed by the model definition is invalid. Swashbuckle team says that this is a valid model definition see this issue: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1942