Repository navigation
feat: support PureQL specification 0.1.0-preview.2.0.1 - #76
Merged
Merged
Conversation
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.
Summary
PureQLQueryDocumentTransformercould not transform the current PureQL specification (0.1.0-preview.2.0.1): it threwNullReferenceExceptioninsideMicrosoft.OpenApi. Since 0.1.0-preview.1.0.0 the specification keeps its definitions in a flat draft 2020-12$defs(add.decimal@row,declares.integer.nullable, …) instead of the nesteddefinitionstree the transformer was written for, and it uses constructsMicrosoft.OpenApicannot read back. This PR makes the transformer produce a correct OpenAPI document from the current specification, keeps support for the olderdefinitionslayout, and tests it against the real specification, pinned as a submodule.Equivalence was checked end to end: the transformed components, turned back into a JSON Schema, accept all 96 valid queries in
samples/validand reject all 1636 insamples/invalidwith ajv, exactly like the original specification. Specifications 0.1.0-preview.0.5.0, 1.0.0, 2.0.0 and 2.0.1 all transform with no dangling$ref.Changes
$defsof current specifications: each entry becomes a component and#/$defs/...references are rewritten to#/components/schemas/.... The nesteddefinitionstree of earlier specifications is still supported._(add.decimal@row→add.decimal_row).$idandversionfrom theQueryschema along with$schema. Otherwise$idrebases every component$refonto the specification's release URL."right": true,"then": true) as{}/{ "not": {} }.Microsoft.OpenApireads them asnulland throws.constas a one-valueenum.Microsoft.OpenApistoresconstas a string, which turned"const": trueinto"const": "True"and made valid queries invalid. Aconstnext to an existingenumjoins it throughallOf, because an emptyenumwould be dropped.PureQL-Specificationsubmodule atsrc/Tests/PureQL-Specification, pinned to tag0.1.0-preview.2.0.1(same layout asPureQL.CSharp.Model.Serialization), and check out submodules in the build-and-test workflow.SpecificationTestsagainst the real specification: every definition is emitted, component names are valid, no reference dangles or points outside the components, and boolean consts stay boolean.FlatDefinitionsTestscovering$defsnaming, reference rewriting, metadata stripping, boolean subschemas in every position, andconsthandling.COVERAGE_THRESHOLD0 → 40 (line rate 40.83%, 265 / 649) andMUTATION_THRESHOLD0 → 64 (mutation score 64.96%).$defs/definitionshandling and the normalizations.Screenshots
Not applicable (no UI changes).