Skip to content

fix: Flatten properties from additional allOf refs - #147

Draft
nikcio wants to merge 1 commit into
mainfrom
feature/fix-allof-multiple-refs
Draft

fix: Flatten properties from additional allOf refs#147
nikcio wants to merge 1 commit into
mainfrom
feature/fix-allof-multiple-refs

Conversation

@nikcio

@nikcio nikcio commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Changes

When a schema uses allOf with multiple ref members, only the first ref becomes the C# base type. Previously, additional ref members were silently dropped, losing their properties.

Now, properties from additional ref members are resolved and flattened into the derived record (since C# doesn't support multiple inheritance).

Example

Derived:
allOf:
- ref: Base -> base type (inheritance)
- ref: Mixin -> properties flattened into Derived
- type: object -> properties included directly

Changes

  • CollectProperties now accepts the base ref schema and resolves additional ref members' properties
  • CollectRequired similarly collects required fields from additional refs
  • 3 new tests: property flattening, required field collection, compilation with TreatWarningsAsErrors

Testing

All 244 tests pass (241 existing + 3 new).

When a schema uses allOf with multiple $ref$ members, only the first
$ref$ becomes the C# base type. Previously, additional $ref$ members
were silently dropped, losing their properties. Now, properties from
additional $ref$ members are resolved and flattened into the derived
record (since C# doesn't support multiple inheritance).

- CollectProperties now accepts the base ref schema and resolves
  additional $ref$ members' properties instead of skipping them
- CollectRequired similarly collects required fields from additional refs
- Add tests for multi-ref flattening, required field collection, and
  compilation with TreatWarningsAsErrors
@nikcio
nikcio marked this pull request as draft August 26, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant