maxdome / swagger-combine

Combines multiple Swagger schemas into one dereferenced schema.
MIT License
132 stars 36 forks source link

Definitions are getting lost on combining #35

Closed manwithsteelnerves closed 6 years ago

manwithsteelnerves commented 6 years ago

I tired merging multiple yaml files and final output doesn't have the definitions/models. Is this expected behaviour?

zimmermannb commented 6 years ago

Same issue here, but with json files. Would be grateful if someone could help us

fabsrc commented 6 years ago

It is true that the definitions are not merged into the combined schema, however they are actually not needed because JSON Schema $Ref Parser's dereference function resolves all references and inlines them into the combined schema. Of course this is not ideal and there is already a feature request (#20) to use the bundle function instead, which would allow the usage of internal references.

Can you give me an example why you would need the definitions in a dereferenced schema as well?

zimmermannb commented 6 years ago

I would like to use the combined output of the individual files to visualize them using the swagger-ui. If the definitions/modell -part is missing the swagger-ui will not show the "Models" section which is quite usefull. Also some other HTML and Doc generators rely on this section of the defintion file

fabsrc commented 6 years ago

OK, that makes sense to me. We'll introduce an option to include the definitions in the combined schema.

shoaib-shah-iag commented 4 years ago

@fabsrc I think you have missed few key things in your implementation:

  1. Only include the definitions/models for the endpoints that included (or not excluded)
  2. Remove the those definitions from inlines and rather have $ref to the definitions.
  3. Will be great if we can get ability to exclude or include a definition (if this can be done first then at least can be used as a workaround for point 1)