translation to anyOf and oneOf has been inverted throughout the conversion process #245
Closed
4 tasks done
Labels
priority:p2
Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days
type:bug
A broken experience
Milestone
According to the JSON schema spec
AnyOf
OneOf
There are a number of places where the conversion library is using anyOf when it should be using instead oneOf, and it seems the confusion originates from the early days of the library, as this comment would indicate.
If we take the example of OData double to illustrate this issue, the library currently produces this.
Which could be translated to a human sentence to "any instance that is a number (rational) or a string or -INF or INF or NaN is a double".
But the missing details here is that we're using "or" and not "xor" (exclusive or).
Semantically speaking, the value will (and should) never be a number AND -INF for example.
I believe the right human sentence should be "any instance that is a number (rational) or a string or -INF or INF or NaN to exactly one of these options is a double". Which would result in the following.
This is even more evident with the geometric data structures where a geometric information can be a point or a line but not both (mathematically speaking, a line is defined a continuous set of points).
OpenAPI.NET.OData/src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiSpatialTypeSchemaGenerator.cs
Lines 217 to 225 in bdf4241
TODO
The text was updated successfully, but these errors were encountered: