Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for self referencing schema (#375)
Previously field with type `Box<Self>` within a `ToSchema` struct or enum did not create correct OpenAPI schema but mistakenly created a reference to unknown type `#/components/schemas/Self`. This commit fixes this issue and now correct type will be created when `Self` keyword is being used withing `ToSchema` structs or enums. E.g. now `struct Item(Box<Self>);` will create a reference like `#/components/schemas/Item`. This commit also makes a breaking change to `ToSchema` trait where previously it was not possible to add a Reference directly to OpenAPI components schemas map even this is allowed by OpenAPI spec. This is commit will change the `ToSchema` return type to `RefOr<Schema>` to allow returning references directly.
- Loading branch information