Open
Conversation
Added a new `NestedHierarchy` sealed trait with cases and a corresponding test to verify schema generation. This enhances test coverage for nested hierarchies in REST schemas.
There was a problem hiding this comment.
Pull request overview
This PR tightens generated OpenAPI schemas for non-flat (nested) sealed hierarchies so they don’t accept arbitrary extra object fields, improving schema strictness and client/server validation correctness.
Changes:
- Update
RestStructure.Union.createSchemafor non-flat hierarchies to setadditionalProperties: falseon discriminator wrapper objects. - Attempt to set
additionalProperties: falseon resolved (inlined) inner case schemas and addtitleon wrapper objects for readability. - Add a
NestedHierarchytest fixture and expected schema output assertions.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| rest/src/main/scala/io/udash/rest/openapi/RestStructure.scala | Tightens non-flat union wrapper schemas and adjusts inlined inner case schemas (additionalProperties: false, plus wrapper title). |
| rest/src/test/scala/io/udash/rest/openapi/RestSchemaTest.scala | Adds a nested hierarchy definition and asserts the stricter, titled schema output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… case tests Only apply additionalProperties=false to inlined case schemas that are actually objects with the default setting, preserving @transparent (primitive) and map-like schema semantics. Add test covering both cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Non-flat (nested) sealed hierarchy schemas does not have discriminator and should be encoded in open-api spec on its own way.