Skip to content

Support parsing schema values exceeding decimal ranges by replacing decimal.Parse with double.Parse - #1594

Closed
Maggie Kimani (MaggieKimani1) wants to merge 8 commits into
devfrom
mk/replace-decimal-with-double
Closed

Support parsing schema values exceeding decimal ranges by replacing decimal.Parse with double.Parse#1594
Maggie Kimani (MaggieKimani1) wants to merge 8 commits into
devfrom
mk/replace-decimal-with-double

Conversation

@MaggieKimani1

@MaggieKimani1Maggie Kimani (MaggieKimani1) commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Fixes#1106,
fixes#1265

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate FailedQuality Gate failed

Failed conditions
51.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarCloud


// multipleOf
writer.WriteProperty(OpenApiConstants.MultipleOf, schema.GetMultipleOf());
writer.WriteProperty(OpenApiConstants.MultipleOf, schema.GetOpenApiMultipleOf());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we forced to prefix with OpenAPI to differentiate from the jsonschema library methods?
Is there any reason why we can't use that library's methods?

@MaggieKimani1Maggie Kimani (MaggieKimani1)Mar 18, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes prefixing with OpenApi helps to distinguish our custom implementation from the JsonSchema.NET library's.
Also we're overriding the library's methods because the keywords such as MultipleOf, Maximum and Minimum are defined as decimal types and we need to replace that and use double for us to support parsing schema values exceeding decimal's ranges.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to PR upstream instead of maintaining our own code in this case?

Base automatically changed from release/2.0.0 to vnextNovember 5, 2024 11:30
@baywet

Copy link
Copy Markdown
Member

sorry about the closure, we have aligned branching with other repositories, if this is still relevant, please re-open on main

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@MaggieKimani1@baywet