Skip to content

Harden parsing of [Range] attribute values#59043

Merged
captainsafia merged 1 commit intomainfrom
safia/fix-range-handling
Nov 20, 2024
Merged

Harden parsing of [Range] attribute values#59043
captainsafia merged 1 commit intomainfrom
safia/fix-range-handling

Conversation

@captainsafia
Copy link
Copy Markdown
Contributor

Addresses #57390.

This change hardens the parsing logic for [Range] attributes to handle:

  • Values that cannot be mapped to a decimal as is required by the minimum and maximum keywords in the OpenAPI schema, like DateTime.
  • Handling for InvariantCulture as is set in RangeAttribute.ParseLimitsInInvariantCulture.

For scenarios where the range value is too large to be represented as a decimal, this implementation will no-op and not set the corresponding minimum or maximum in the OpenAPI document.

@captainsafia captainsafia requested a review from a team as a code owner November 19, 2024 01:56
@ghost ghost added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Nov 19, 2024
Copy link
Copy Markdown
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@captainsafia captainsafia merged commit c6dab02 into main Nov 20, 2024
@captainsafia captainsafia deleted the safia/fix-range-handling branch November 20, 2024 16:29
@captainsafia
Copy link
Copy Markdown
Contributor Author

/backport to release/9.0

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/9.0: https://github.com/dotnet/aspnetcore/actions/runs/11937638584

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

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants