Skip to content

Types with same name overrides schemas in components #1

Description

@Flowneee

If there is 2 or more types with same name, they will override each other, when schema generated. For example

handler1.rs

#[derive(JsonSchema)]
struct Request {
    name: String
}

handler2.rs

#[derive(JsonSchema)]
struct Request {
    id: u64
}

will create only one definition in #/components/schema, and handlers from both files wil reference same schema.

First potenial fix - enable inlining in https://docs.rs/schemars/latest/schemars/gen/struct.SchemaSettings.html#structfield.inline_subschemas, which will solve most problems (probably everything sxcept recursive types).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions