Skip to content

#/components/schemas across routes #909

@EnriqueL8

Description

@EnriqueL8

I have a set of routes that share a child schema such as one API returns an array of objects and another API returns one object. The object itself has the same schema but when I generate the OpenAPI I get duplicate values for that schema and do not get the schema stored under #/components/schemas. I might be doing something wrong here... so any insights appreciated 😄

I'm using NewSchemaRefForValue for each return object from my API. It will get called either with the array of objects or the objects. With the schema ref it returns I will append it to the document I'm constructing.

I see that for a new schema do be added to #/components/schemas it needs to be a cyclical dependency? But as far as I can see that only happens in the context of that specific schema as it checks for parents. How do I provide other schemas in the OpenAPI that I have parsed?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions