Skip to content

Capitalization seems wonky for templatized types in openapi spec #1455

Open

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.

Activity

  1. added
    api
    on Jun 23, 2023
  2. added
    obsolete
    on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiobsolete

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions