Skip to content

Support schemars #66

@JohnScience

Description

@JohnScience

Crate: https://docs.rs/schemars/0.8.22/schemars/.

Support can be enabled via a feature. What it takes a simple derive. Maybe I can do that later.

As a temporary fix, I did

// We can't derive `JsonSchema` because `ArcStr` doesn't implement it
// and we can't implement it for `ArcStr` because
// both `JsonSchema` trait and `ArcStr` type are external to this crate.
impl JsonSchema for IString {
    fn schema_name() -> String {
        "IString".to_string()
    }

    fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
        <String as JsonSchema>::json_schema(gen)
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions