Skip to content

Add more schema tests #60822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2025
Merged

Add more schema tests #60822

merged 1 commit into from
Mar 11, 2025

Conversation

captainsafia
Copy link
Member

Forward port of tests from #60410.

@Copilot Copilot AI review requested due to automatic review settings March 8, 2025 05:26
@captainsafia captainsafia requested a review from a team as a code owner March 8, 2025 05:26
@ghost ghost added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Mar 8, 2025
Copy link
Contributor

@Copilot 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.

PR Overview

This PR adds additional tests and sample endpoints to verify correct OpenAPI schema transformation and reference resolution, as well as forward porting tests from an earlier ASP.NET Core pull request.

  • Added tests for resolving list-based schema references, self-referential schemas, and shared type references.
  • Expanded sample endpoints with new schema definitions to exercise schema mapping and demonstrate potential pitfalls.

Reviewed Changes

File Description
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/Implementations/OpenApiSchemaReferenceTransformerTests.cs Adds tests to validate correct OpenAPI reference handling and schema structure.
src/OpenApi/sample/Endpoints/MapSchemasEndoints.cs Introduces additional endpoints and new schema classes to demonstrate and test schema mapping.

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/OpenApi/sample/Endpoints/MapSchemasEndoints.cs:72

  • [nitpick] The property 'value' does not follow standard PascalCase naming conventions; consider renaming it to 'Value'.
public int value { get; set; }

@captainsafia
Copy link
Member Author

cc: @baywet This PR contains some tests I wrote to fix the local ref issues in .NET 9. A few of them fail in .NET 10 too based on the bug in microsoft/OpenAPI.NET#2062. We can use these as validation when the fix for that goes in.

@captainsafia captainsafia added feature-openapi area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Mar 8, 2025
@captainsafia captainsafia enabled auto-merge (squash) March 10, 2025 20:49
@captainsafia captainsafia merged commit 4dc6e60 into main Mar 11, 2025
27 checks passed
@captainsafia captainsafia deleted the cs/schema-tests branch March 11, 2025 01:25
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview3 milestone Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants