Skip to content

fix(output): enforce flat list structure by disallowing nested details - #1817

Open
SHUBHANSHU602 wants to merge 1 commit into
json-schema-org:mainfrom
SHUBHANSHU602:fix/flat-list-output
Open

SHUBHANSHU602 wants to merge 1 commit into
json-schema-org:mainfrom
SHUBHANSHU602:fix/flat-list-output

Conversation

@SHUBHANSHU602

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix in the machine-readable output schema with regression tests.

Issue & Discussion References

Related to #1796 and #1797.

This PR addresses a distinct validation issue in the list-specific output definition. It does not attempt to resolve public-root schema masking.

Problem

The machine-readable output specification requires list output to have a flat structure, with details appearing only at the root.

However, the current list definition references the recursive outputUnitArray, allowing individual list output units to contain nested details.

Consequently, both empty and non-empty nested details are incorrectly accepted when validating against the list definition.

Root Cause

The list and hierarchical formats share the same recursive output-unit definition without imposing format-specific nesting constraints.

Proposed Solution

  • Introduce a dedicated listOutputUnit definition that references the existing outputUnit.
  • Explicitly prohibit the details property within list entries.
  • Preserve existing shared validation constraints and implementation-specific extension properties.
  • Leave hierarchical output recursion unchanged.

This approach avoids duplicating the shared output-unit schema.

Testing and Verification

Before the fix:

  • 38/40 output-schema tests passed.
  • Both new negative regression tests failed because nested details were incorrectly accepted.
image

After the fix:

  • All 57 tests passed across 4 test files.
  • All 22 hierarchical output tests passed.
  • The extension-property regression test passed.
  • ESLint and Markdown linting passed.
  • All 8 specification HTML files built successfully.
  • git diff --check passed.
  • Working tree remained clean.
image

Does this PR introduce a breaking change?

Previously accepted nested details are now rejected when validating against the list-specific definition, aligning validation with the documented flat-list requirement.

Hierarchical output validation and public-root branch selection remain unchanged.

Opening this as a draft to discuss the approach and coordinate with the related changes in #1797.

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