Skip to content

Capitalization seems wonky for templatized types in openapi spec #1455

@smklein

Description

@smklein

For example, see:

/// A type storing a range over `T`.
///
/// This type supports ranges similar to the `RangeTo`, `Range` and `RangeFrom` types in the
/// standard library. Those cover `(..end)`, `(start..end)`, and `(start..)` respectively.
#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Serialize, JsonSchema)]
#[schemars(rename = "BinRange{T}")]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum BinRange<T> {
/// A range unbounded below and exclusively above, `..end`.
RangeTo { end: T },
/// A range bounded inclusively below and exclusively above, `start..end`.
Range { start: T, end: T },
/// A range bounded inclusively below and unbounded above, `start..`.
RangeFrom { start: T },
}

In the openapi spec, this becomes:

"BinRangedouble": {

Even though it should probably be BinRangeDouble.

It seems like the line:

 #[schemars(rename = "BinRange{T}")] 

Is the crux of this - AFAICT, this is part of schemars, which documetns that {T} performs a replacement, but it is unclear how to get the right PascalCase capitalization here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiRelated to the API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions