Repository navigation
🐛 fix(validate): enforce range facets on g* dates - #2279
Merged
Merged
Conversation
Range facets on xs:gYear, xs:gYearMonth, xs:gMonth, xs:gMonthDay and xs:gDay were checked as plain strings, so a value outside the bound passed. These types now have an order: a field the value leaves out takes its value from 1972-12-31, and a missing day takes the last day of its month (XSD 1.1 Part 2, appendix D.2.1). A value with a timezone is ordered against one without only when the result holds for every offset within fourteen hours, as it already is for dateTime.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Range facets on
xs:gYear,xs:gYearMonth,xs:gMonth,xs:gMonthDayandxs:gDaydid not constrain values, so a schema that bounded one of these types accepted values outside the window it stated. Once this merges, those five types are checked against their bounds in the order XML Schema 1.1 gives them, and out-of-window values fail. Fixes #2278.The order that already covers
xs:date,xs:dateTime,xs:timeandxs:durationnow covers the five partial types too. A value that leaves out its year, month or day is placed on the timeline with those fields taken from 1972-12-31, the reference that XML Schema 1.1 Part 2, appendix D.2.1 gives for absent components, and a missing day takes the last day of its month. A value with a timezone is ordered against one without only when the order holds for every offset within fourteen hours, the rulexs:dateTimealready follows. Schemas that never bound these types see no change.Behavior changes
XMLSchemaandRelaxNG, so documents that validated before can now be invalid.