8000 Add NestedHierarchy schema and tests by halotukozak · Pull Request #1447 · UdashFramework/udash-core · GitHub
[go: up one dir, main page]

Skip to content

Add NestedHierarchy schema and tests#1447

Open
halotukozak wants to merge 3 commits intomasterfrom
fix-sealed-nested-open-api
Open

Add NestedHierarchy schema and tests#1447
halotukozak wants to merge 3 commits intomasterfrom
fix-sealed-nested-open-api

Conversation

@halotukozak
Copy link
Member
@halotukozak halotukozak commented Mar 10, 2026

Non-flat (nested) sealed hierarchy schemas does not have discriminator and should be encoded in open-api spec on its own way.

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.
Copilot AI review requested due to automatic review settings March 10, 2026 09:57
Copy link
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 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.createSchema for non-flat hierarchies to set additionalProperties: false on discriminator wrapper objects.
  • Attempt to set additionalProperties: false on resolved (inlined) inner case schemas and add title on wrapper objects for readability.
  • Add a NestedHierarchy test 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.

halotukozak and others added 2 commits March 10, 2026 11:06
… 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>
Copy link
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

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.

@halotukozak halotukozak self-assigned this Mar 10, 2026
@halotukozak halotukozak requested a review from sebaciv March 10, 2026 12:56
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.

2 participants

0