Skip to content

Fix assignment of JSON Schema formats in the OpenAPI adapter#9551

Merged
glen-84 merged 1 commit intomainfrom
gai/fix-open-api-formats
Apr 15, 2026
Merged

Fix assignment of JSON Schema formats in the OpenAPI adapter#9551
glen-84 merged 1 commit intomainfrom
gai/fix-open-api-formats

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Apr 15, 2026

Summary of the changes (Less than 80 chars)

  • Fix assignment of JSON Schema formats in the OpenAPI adapter.

Copilot AI review requested due to automatic review settings April 15, 2026 09:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes JSON Schema/OpenAPI format generation for scalar types in the OpenAPI adapter so emitted OpenAPI documents reflect correct numeric widths/precision (and adds coverage for unsigned scalar formats).

Changes:

  • Update scalar-to-OpenAPI format mapping to correctly emit double for Float, and correct integer widths for Byte/Short/Long plus unsigned integer scalar formats.
  • Extend the OpenAPI adapter integration test schema and HTTP POST test payload to include unsigned numeric scalar fields.
  • Update OpenAPI snapshot baselines to reflect the corrected formats.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/HotChocolate/Adapters/src/Adapters.OpenApi.AspNetCore/DynamicOpenApiDocumentTransformer.cs Adjusts GetJsonSchemaFormat to correctly assign formats for spec scalars and ChiliCream scalar URIs (including unsigned scalars).
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/TestSchema.cs Adds unsigned scalar fields to the complex object input/output used by OpenAPI integration tests.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/Endpoints/HttpEndpointIntegrationTestBase.cs Extends complex-object POST request JSON to include unsigned scalar fields.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApi/snapshots/OpenApiIntegrationTestBase.OpenApi_Includes_Initial_Routes_NET9_0.json Snapshot update for corrected scalar formats and added unsigned fields.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApi/snapshots/OpenApiIntegrationTestBase.OpenApi_Includes_Initial_Routes_NET9_0_Fusion.json Snapshot update for corrected scalar formats and added unsigned fields (Fusion).
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApi/snapshots/OpenApiIntegrationTestBase.OpenApi_Includes_Initial_Routes_NET10_0.json Snapshot update for corrected scalar formats and added unsigned fields.
src/HotChocolate/Adapters/test/Adapters.OpenApi.Tests/OpenApi/snapshots/OpenApiIntegrationTestBase.OpenApi_Includes_Initial_Routes_NET10_0_Fusion.json Snapshot update for corrected scalar formats and added unsigned fields (Fusion).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants