[repo-assist] test: expand V3 oneOf/anyOf/allOf and V2 inheritance schema compilation tests (+11 tests, 448→459)#447
Merged
sergey-tihon merged 3 commits intoMay 22, 2026
Conversation
…on tests (+11 tests, 448→459) - V3: oneOf/anyOf with multiple $refs does not emit a wrapper type (compileNewObject marks it as a name alias and returns obj when no own properties exist) - V3: oneOf/anyOf multi-ref still emits the referenced component types - V3: allOf single $ref with extra wrapper properties falls through to compileNewObject (guard requires Properties.Count = 0) and emits a new named type with the extra prop - V2: required property compiles to non-option type; optional to option type - V2: allOf inheritance ($ref + inline schema) emits both base and derived types; derived type carries its own declared property Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR expands the Swagger/OpenAPI schema compilation test suite to cover additional previously untested branches in the DefinitionCompiler pipeline, focusing on OpenAPI v3 composition (oneOf/anyOf/allOf) and Swagger v2 required/optional property handling plus allOf inheritance.
Changes:
- Add OpenAPI v3 tests for
oneOf/anyOfmulti-$refname-alias behavior andallOfsingle-$refwith extra wrapper properties. - Add Swagger v2 tests for required vs optional property typing and
allOfinheritance ($ref+ inline schema) behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/SwaggerProvider.Tests/Schema.V3SchemaCompilationTests.fs | Adds new v3 schema compilation tests around oneOf/anyOf multi-ref wrappers and allOf wrapper properties. |
| tests/SwaggerProvider.Tests/Schema.V2SchemaCompilationTests.fs | Adds new v2 schema compilation tests for required/optional properties and allOf inheritance patterns. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
6 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds 11 new schema compilation tests (448 → 459) covering previously untested branches in
DefinitionCompiler:V3 schema tests (9 new)
oneOf/anyOfwith multiple$refs — name-alias behaviouroneOf/anyOfcontains ≥2 refs and no own properties,compileNewObject()callsns.MarkTypeAsNameAliasand returnstypeof<obj>— no wrapper type is emitted.Union,AnyUnion) are absent from the output, while the referenced component types (Cat,Dog,Fish,Bird) are present.allOfsingle$refwith extra wrapper properties — guard missAllOf.Count = 1 && Properties.Count = 0) requires zero extra properties; adding even one property makes it fall through tocompileNewObject().Extendedis emitted as a named object type and exposes its ownExtraproperty.V2 schema tests (5 new)
Required vs optional properties
int32)string option)allOfinheritance ($ref+ inline schema)DoghasallOf: [$ref: Animal, {properties: {breed: string}}]AnimalandDogare emitted, andDogexposes its ownBreedproperty.Test Status
Build passes with no errors. Fantomas format check passes.