Validate every response against the OGC schemas - #54
Merged
Conversation
Annex A's prose says what a response must carry; the schemas say it in a form a machine checks. A suite that asserts the fields it thought to name passes a document missing everything it forgot, so the schema is what makes the conformance claim mean something. openapi/ogcapi-movingfeatures-1.bundled.json is the OpenAPI document OGC publishes for Part 1, vendored byte for byte and never edited. It is the bundled form, so every reference resolves inside the one file and the validation needs no network: it runs in the same job as every other test. A test guarded by MFAPI_SCHEMA_FRESHNESS re-fetches the URL and compares. The landing page, the conformance declaration, a Collections document, a Collection, a TemporalProperties document and a TemporalGeometrySequence are each validated against the schema the standard names for it. One translation is applied and its count asserted: OpenAPI 3.0 spells nullability as `nullable: true` beside a type where a JSON Schema draft spells a type union, and a validator that does not know the keyword would silently admit a null the standard admits anyway. The count keeps the rewrite from becoming a no-op, since a translation that stops applying makes the run more permissive without saying so. Nothing else is rewritten: no schema puts a sibling keyword beside a reference, and neither exclusive bound appears in the boolean form, so the two dialects agree on every other keyword present. `format` is asserted rather than annotated, and TestATSSchemaMotionCurve- IsInverted measures why: at JSON Schema's default the standard's own motionCurve rejects all five interpolation values it names and accepts an arbitrary string, because its two oneOf branches both match a plain string. The test also measures the correction proposed for it, an absolute-URI pattern on the URI branch, which answers correctly under both readings where anyOf does not. Two further tests record what the standard says about itself rather than asserting a constant somebody chose: the temporalGeometrySequence enum that settles Annex A's contradiction, and the datetimes of a temporal geometry carrying no format where those of a temporal property carry date-time. The second is a gap in this validation, and it is stated so that a passing TemporalGeometrySequence is not mistaken for a checked one.
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.
Annex A's prose says what a response must carry; the schemas say it in a form a machine checks. A suite that asserts the fields it thought to name passes a document missing everything it forgot, so the schema is what makes the conformance claim mean something.
openapi/ogcapi-movingfeatures-1.bundled.jsonis the OpenAPI document OGC publishes for Part 1, vendored byte for byte and never edited. It is the bundled form, so every$refresolves inside the one file and validation needs no network — it runs in the same job as every other test. A test guarded byMFAPI_SCHEMA_FRESHNESSre-fetches the URL and compares. The landing page, the conformance declaration, a Collections document, a Collection, a TemporalProperties document and a TemporalGeometrySequence are each validated against the schema the standard names for it.One translation is applied and its count asserted: OpenAPI 3.0 spells nullability as
nullable: truebeside a type where a JSON Schema draft spells a type union, and a validator that does not know the keyword would quietly ignore it. Asserting the count keeps the rewrite from becoming a no-op, since a translation that stops applying makes the run more permissive without saying so. Nothing else is rewritten — measured on this document, no schema puts a sibling keyword beside a$ref, and neither exclusive bound appears in the boolean form OpenAPI uses.formatis asserted rather than annotated, andTestATSSchemaMotionCurveIsInvertedmeasures why. At JSON Schema's default reading, the standard's ownmotionCurverejects all five interpolation values it names and accepts an arbitrary string, because its twooneOfbranches both match a plain string:formatformatassertedDiscrete…Cubichttp://example.org/curveBogusThe same test measures the correction proposed for it — an absolute-URI pattern on the URI branch — which answers correctly under both readings, where
anyOfcontinues to acceptBogus.Two further tests record what the standard says about itself rather than asserting a constant somebody chose: the
temporalGeometrySequenceenum that settles Annex A's contradiction, and the fact that a temporal geometry'sdatetimescarry no format where a temporal property's carrydate-time. The second is a gap in this validation rather than a finding about the tier, and it is stated so a passing TemporalGeometrySequence is not mistaken for a checked one.