State a temporal property's unit as the schema admits - #52
Merged
Conversation
/components/schemas/temporalProperty gives `form` two branches and nothing else: an absolute URI, or a string of exactly three characters. That excludes most unit symbols in ordinary use, the metre's own among them, and it excludes the empty string, which the tier wrote for a property carrying no unit at all. A unit is named by its OGC register URI, http://www.opengis.net/def/uom/ UCUM/0/ keyed by the UCUM code, which is the shape the tier already names a temporal reference system by. The derived properties carry m_s-1 and m; the conformance fixture carries km_h-1 and deg. A property with no unit omits the member rather than writing it empty, which the schema admits since form is optional. The unit is checked where it is stored, not only where it is published. A unit no conformant document can carry would otherwise be published unconformantly or dropped without saying so, and a caller writing it can still fix it; the check runs before the transaction opens, so a request that cannot succeed costs none.
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.
/components/schemas/temporalPropertygivesformtwo branches and nothing else: an absolute URI, or a string of exactly three characters. That excludes most unit symbols in ordinary use — the metre's own among them — and it excludes the empty string, which the tier wrote for a property carrying no unit at all.A unit is named by its OGC register URI,
http://www.opengis.net/def/uom/UCUM/0/keyed by the UCUM code, which is the shape the tier already names a temporal reference system by. The derived properties carrym_s-1andm; the conformance fixture carrieskm_h-1anddeg. A property with no unit omits the member rather than writing it empty, which the schema admits sinceformis optional.The unit is checked where it is stored, not only where it is published: a unit no conformant document can carry would otherwise be published unconformantly or dropped without saying so, and a caller writing it can still fix it. The check runs before the transaction opens, so a request that cannot succeed costs none. This is the strict-reader / conformant-writer combination — rejecting a document whose value the type system cannot carry is a documented limitation, where emitting a document that fails the schema is the actual violation.
TestATSFormIsWhatTheSchemaAdmitspins the two branches against ten cases including the metre andkm/h, andTestATSFormRefusedOnWriteproves a POST carryingkm/hanswers 400 naming the unit it refuses.