Repository navigation
Support discriminated merge-patch model hierarchies - #286
Merged
Merged
Conversation
Project companion hierarchies with required immutable discriminators across Kotlin, Swift, TypeScript, and Python. Preserve deletion permissions and subtype validation, retain tags in conversion helpers, and reject cross-subtype merges. Add compile-backed frontend/runtime regressions and document the typed patch contract.
kdubb
marked this pull request as ready for review
October 20, 2026 17:35
[Medium impact] The changes since the previous review appear safe to merge. SummaryAdds discriminated merge-patch companions across Kotlin, Swift, TypeScript, and Python.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Discriminated object schema] --> B[Ordinary model hierarchy]
A --> C[Patch companion hierarchy]
C --> D[Required discriminator]
C --> E[Omission-aware ordinary fields]
C --> F[Variant-only field exclusions]
B --> G[Snapshot, difference, and merge helpers]
C --> G
Reviews (2) 路 Last reviewed commit: "Keep discriminated patch field exclusion..." 路 Reviewed by Greptile |
Separate variant exclusions from inherited schema patterns, override Python wire validators for patch descendants, and add three-level compiler-backed regression coverage. Document the new IR metadata.
kdubb
enabled auto-merge
October 20, 2026 18:07
|
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.



Discriminated object schemas used in merge-patch request bodies previously failed generation. They now produce companion hierarchies such as
AnimalPatch,CatPatch, andDogPatch, with a required, non-null discriminator and omission-aware ordinary fields.The shared IR preserves discriminator mappings and original deletion permissions. Kotlin/JAX-RS, Kotlin clients, Swift, TypeScript, and Python reject missing/null/unknown tags and fields belonging to another variant while retaining permitted extension fields. Snapshot and difference helpers retain the tag, and merge helpers reject subtype changes (or prevent them through Swift's concrete parameter types). Ordinary model contracts remain unchanged.
Compiler-backed runtime coverage includes OpenAPI, RAML, AsyncAPI, composed sources, explicit annotations with automatic promotion disabled, renamed discriminator wire names, response tolerance, required-nullable fields, decoding/encoding, and conversion/merge. Documentation describes the discriminator contract and the service's responsibility to compare it with the persisted resource.
Validation:
Closes #285.