Skip to content

[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 into
masterfrom
repo-assist/test-schema-compilation-20260522-25e32bbd5fb913d5
May 22, 2026
Merged

[repo-assist] test: expand V3 oneOf/anyOf/allOf and V2 inheritance schema compilation tests (+11 tests, 448→459)#447
sergey-tihon merged 3 commits into
masterfrom
repo-assist/test-schema-compilation-20260522-25e32bbd5fb913d5

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 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/anyOf with multiple $refs — name-alias behaviour

  • When oneOf/anyOf contains ≥2 refs and no own properties, compileNewObject() calls ns.MarkTypeAsNameAlias and returns typeof<obj> — no wrapper type is emitted.
  • Tests verify the wrapper schema names (Union, AnyUnion) are absent from the output, while the referenced component types (Cat, Dog, Fish, Bird) are present.

allOf single $ref with extra wrapper properties — guard miss

  • The collapse guard (AllOf.Count = 1 && Properties.Count = 0) requires zero extra properties; adding even one property makes it fall through to compileNewObject().
  • Tests verify that Extended is emitted as a named object type and exposes its own Extra property.

V2 schema tests (5 new)

Required vs optional properties

  • Required property → non-option type (int32)
  • Optional property → option type (string option)

allOf inheritance ($ref + inline schema)

  • Standard Swagger 2.0 inheritance pattern: Dog has allOf: [$ref: Animal, {properties: {breed: string}}]
  • Tests verify both Animal and Dog are emitted, and Dog exposes its own Breed property.

Test Status

SwaggerProvider.Tests  Total: 459, Errors: 0, Failed: 0, Skipped: 1, Time: ~0.9s

Build passes with no errors. Fantomas format check passes.

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@dcdf09723d42ef9b6c75335e4612fd145d4ccdaa

…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>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 22, 2026 20:33
Copilot AI review requested due to automatic review settings May 22, 2026 20:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/anyOf multi-$ref name-alias behavior and allOf single-$ref with extra wrapper properties.
  • Add Swagger v2 tests for required vs optional property typing and allOf inheritance ($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.

Comment thread tests/SwaggerProvider.Tests/Schema.V3SchemaCompilationTests.fs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon merged commit a976670 into master May 22, 2026
2 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/test-schema-compilation-20260522-25e32bbd5fb913d5 branch May 22, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants