Repository navigation
[pull] master from OpenAPITools:master - #773
Merged
Merged
Conversation
…ethod in query generation (#24781)
* feat(cpp-boost-beast): OAS 3.1 schema validation support Generates a compile-time-validating C++ Boost.Beast client for OpenAPI 3.1 documents: densified schema IR, exact numeric lexemes, composition (oneOf/anyOf/allOf) semantics with `CompositionBranchValue` tagged variants, JSON-Schema-2020-12 vocabulary support (`not`, boolean value-schemas, `$dynamicRef`/`$dynamicAnchor`, `dependentRequired`, `contains`, `patternProperties`, `propertyNames`, `if`/`then`/`else`, type arrays, deep enum/const stores), SSE (text/event-stream) modes, multipart encoding metadata, and decode-time validation of every branch. ## What's in this PR 1. **Generator restructuring** (behavior-preserving, output byte-identical): the 9,216-line `CppBoostBeastClientCodegen` monolith is split into `Oas31KeywordScanner`, `Oas31RawSpecRecovery`, `Oas31SchemaIrEmitter` and `Oas31CompositionLowering` (codegen down to ~3,700 lines). Verified by a full battery equivalence run (JSTS 281/281 corpus cases, Gate A 191/191, generated-path 39/39, Wave-1-complete 35/35, M-probe 50/50, sample determinism, `-Werror` compilation of all generated TUs) before and after. 2. **Densified schema IR + evaluator**: every schema/branch/component is flattened into a `SchemaNode` registry (`schema_ir.generated.cpp`) and validated at decode time by the generated `SchemaEvaluator`. Numeric constraints carry their original lexemes (`ExactNumber::parseLexeme` / `setExact`) so values > 2^53, decimals like 0.3 and exponent forms reconstruct exactly — no double-rounding drift. 3. **OAS 3.1 / 2020-12 vocabulary**: type arrays (incl. literal `"null"`), boolean value-schemas, `not` subschemas, deep (array/object) enum/const, `uniqueItems`, `min/maxContains` + `contains`, `dependentRequired` (with raw-literal recovery for the parser's list-merge corruption), `patternProperties`/`propertyNames`, `min/maxProperties`, `$ref` resource identity + `$dynamicRef`/`$dynamicAnchor` scope resolution, annotation keywords per 2020-12 §8.2.6 (`contentEncoding`/`contentMediaType`/ `contentSchema`, `$comment` shape checks). 4. **Composition semantics**: `CompositionBranchValue<N, T>` tagged variants preserve branch identity (dedup, null-collapse, enum-union cases no longer blind-collapse to `std::string`); oneOf exactly-one enforcement; anyOf at-least-one; discriminator-based branch reordering for diagnostics; allOf flat synthetic models with enum intersection; optional-impossible property rejection; fail-closed generation only where a membership-affecting assertion has no generated validator. 5. **SSE and wire support**: `sseSchemaMode=representation|jsonEventData` + `x-sse-event-data-schema` per-operation opt-in, `formatAssertionPolicy= annotation|strict`, `compileWithValidation=true|false` (default true — decode-time validation is the feature; disable to compile it out). 6. **Tests** (120, all passing): test suite split into `Oas31IrComplianceTest` (34) / `CompositionLoweringTest` (46) / `ModelApiSurfaceTest` (33) + `CppBoostBeastTestSupport`; fixtures relocated * fix(cpp-boost-beast): preserve normalized OAS 3.1 constraints * fix(cpp-boost-beast): advertise not schema support * fix(cpp-boost-beast): address OAS 3.1 review findings * test(cpp-boost-beast): parallelize runtime compile * fix(cpp-boost-beast): preserve normalized schema structure * fix(core): avoid recursive inline schema name collisions * fix(cpp-boost-beast): compile complex OAS 3.1 clients * fix(cpp-boost-beast): preserve nullable SSE semantics * fix(cpp-boost-beast): validate nullable enum values * fix(cpp-boost-beast): honor compileWithValidation=false * fix(cpp-boost-beast): harden multipart and null decoding * fix(cpp-boost-beast): address review regressions * test(cpp-boost-beast): cover false boolean decoding * fix(cpp-boost-beast): tolerate response null drift * fix(cpp-boost-beast): preserve normalized reference identity * fix(cpp-boost-beast): preserve HTTP error response bodies * fix(cpp-boost-beast): resolve OAS 3.1 review findings * fix(cpp-boost-beast): handle null defaults on model branches * fix(cpp-boost-beast): handle composed defaults and nullable SSE * fix(cpp-boost-beast): support Windows shared libraries * chore(cpp-boost-beast): refresh 7.26 sample * fix(cpp-boost-beast): address OAS 3.1 review feedback * fix(cpp-boost-beast): bound OAS schema scanner recursion * fix(cpp-boost-beast): address remaining OAS 3.1 review feedback * fix(cpp-boost-beast): intersect nullability across allOf * fix(cpp-boost-beast): honor enum null constraints * ci: rerun transient CircleCI checkout * ci: retry transient checkout failures * fix(ci): checkout pull requests over HTTPS * fix(ci): restrict pull ref fallback * refactor(cpp-boost-beast): split OAS 3.1 generator components * fix(cpp-boost-beast): address OAS 3.1 review feedback * chore(cpp-boost-beast): regenerate sample client * fix(cpp-boost-beast): preserve nested recursive constraints * docs(cpp-boost-beast): refresh generator options * chore(cpp-boost-beast): refresh generated artifacts * fix(cpp-boost-beast): preserve allOf null const constraints * fix(cpp-boost-beast): honor recovered type-array nulls * fix(cpp-boost-beast): address review feedback * fix(cpp-boost-beast): avoid extras name collisions
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )