Skip to content

fix(schemas): correct Core metadata and generated API conformance - #574

Closed
marcschier wants to merge 25 commits into
xregistry:mainfrom
marcschier:fix/schema-generator-core-conformance
Closed

marcschier wants to merge 25 commits into
xregistry:mainfrom
marcschier:fix/schema-generator-core-conformance

Conversation

@marcschier

@marcschier marcschier commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Current-main refresh

Merged xregistry/spec:main at 8e8c6e0f12570efcc69782c8e9e672bc50ae727f in c2485c92 with DCO sign-off. This includes #725, #727, #728, #731, #732, #733 and #734.

The refreshed emitters now read scalar array/map restrictions from item.enum, matching the Endpoint source changed by #732. The real Endpoint test exposed missing restrictions in JSON Schema, OpenAPI and Avro before the repair. Default/strict and advisory cases now pass; owner-qualified Avro enums are preserved. All sixteen artifacts regenerate and independently reproduce; the complete tools suite passes 332 cases. Existing metadata, raw-document and generated API corrections remain separate from #724's broader validation work.

The existing PR grouping is preserved. Earlier commit-specific results below are historical; current hosted checks apply to the refreshed head.


Fixes #573

Proposed Changes

Correct the released schema generator's Core metadata and generated API
contracts, independently of the federation work in #571.
The existing structured-array, metadata, timestamp, navigation and Version
addressing fixes remain.

The review follow-up fixes all nine reported defects:

  • 574-S01/S02: separate metadata-only Resource POST inputs, Version
    outputs and raw document content. Ignore permitted Resource read-only
    input fields without admitting them as Version output fields.
  • 574-S03/S04/S05/S06: preserve owning namespaces and unique Avro record
    names, define structured wildcard records before referencing them, apply
    Core overlays once, and generate Registry conditionals in the root namespace.
  • 574-S07/S08/S09: retain native JSON Structure URI-reference types,
    keep Meta controls out of unmodeled Version fields, and make inlined
    model/capability slots objects rather than unconstrained values.

Head covered by the verification below:
2b23699.
All changes are signed forward commits; the original history is retained.

Issue721 document-contract follow-up

Commit f76f4f24 additionally addresses the functional document/API contracts
in #721 W04-c through W04-i. The real generator and OpenAPI
template now distinguish document metadata headers from legacy query
parameters; use xRegistry-<effective singular>id and the other Core scalar
headers; expose map headers per key rather than as an aggregate; and keep native
Location, Content-Location and Content-Disposition grammars separate from
already-encoded private header values.

The generated operations distinguish 200 updates, 201 creation and body-free
303 redirects. Metadata-only routes do not gain document redirects. Document
PUT responses retain binary as well as domain JSON content, and Resource and
Version header contexts remain distinct.

The 54 added cases in tools/test_schema_generator_regressions.py exercise
the real generator, validate whole OpenAPI descriptions and cover imported
Resource types. They add no mock server, header-policy simulator or prose
assertions. At f76f4f24, the complete tools suite passed 320 cases and
all sixteen outputs independently reproduced. docs/RELEASE_NOTES.md records
the related wire-contract changes. Structural schemas cannot prove native
header serialization or server concurrency behavior.

The separate Primer typo, W04-k, belongs to marcschier#1.
Complementary ProblemDetails, flag and metadata-input work remains in
#724; the lossless carrier proposal remains in #656.
These standalone results do not establish correctness of a later composition
of those independently evolving branches.

Earlier review verification (historical evidence)

For the earlier review-fix range 83ef18a..2b23699, the focused
generator/regression suite passed 168 cases and the full tools suite passed
211. All sixteen outputs independently reproduced. Relative to 83ef18a,
twelve outputs changed and the four JSON Schema outputs stayed identical;
against main (9ecf8ea), all sixteen outputs change. Source models and
applicable documentation/authoring checks passed.

A clean CI run exposed an undeclared optional URI-reference checker. The
follow-up declares jsonschema[format-nongpl] and asserts checker registration,
retaining all malformed-URI rejection checks. The generator and output bytes
are unchanged by that dependency correction.

For that head, hosted verify
and DCO passed.
The earlier unpublished composition with #722, #723 and
#724 passed 696 cases and reproduced all sixteen combined outputs.
That composition requires explicit source-level merge resolution; it is not a
claim of conflict-free merging.

Compatibility and Scope

Avro qualified names and repaired layouts can affect generated readers:
regenerate bindings and assess compatibility. JSON Structure evidence is
bounded emitted-contract and URI/object validation, not full native SDK
certification. The scalar profile in #656 is not adopted here.

Release Note

Correct Resource POST and raw-document schemas, Avro record ownership and
Core overlays, and JSON Structure URI, Version and Registry metadata types.
Regenerate the affected artifacts and enable the required format checks.

Isolate verified generator defects from federation review feedback. Add reproducible regressions and regenerate affected domain schemas. Fixes xregistry#573.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
marcschier added a commit to marcschier/xregistry-drafts that referenced this pull request Sep 10, 2026
Restore the primer and CloudEvents schema artifacts to the PR baseline as requested in xregistry#571. Track future primer work in xregistry#572 and verified generator bugs in xregistry#573 with separate PR xregistry#574. Align the authored 1.0-rc1 draft status and tests and remove a stale TOC link and trailing whitespace.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier marcschier changed the title DRAFT: Fix schema generator Core metadata and API conformance Fix schema generator Core metadata and API conformance Sep 11, 2026
@marcschier
marcschier marked this pull request as ready for review September 11, 2026 04:55
Overlay Core Avro fields rather than duplicating them, share Meta declarations with structured deprecation, and allow ordinary Version metadata without inline document content. Add regressions and regenerate all affected released-domain artifacts for xregistry#574.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
marcschier added a commit to marcschier/xregistry-drafts that referenced this pull request Sep 11, 2026
Define client/server hosting, local Resource shadowing, ordered source selection and diagrams. Move the portable document format beside its bindings, add binding motivations, remove crosswalks and legacy xregurl wording, and rewrite semicolon-delimited prose. Fix all four code-review defects with regressions. Keep all released schema artifact changes in xregistry#574 and out of xregistry#571. Leave review threads unresolved as requested.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier
marcschier marked this pull request as draft September 14, 2026 13:55
Generate a distinct Version component even for maxversions=1, and use it
for metadata-only Resource POST request and 201 response bodies. Keep
Resource navigation out of Version metadata for declared and imported
types without changing requiredness or document-bearing POSTs.

Add 16 source-generator regression cases and regenerate the four affected
released OpenAPI outputs. Preserve the prior Avro and Core metadata fixes.

Fixes xregistry#573

Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier

Copy link
Copy Markdown
Contributor Author

Completed the two Version-reference residuals in the owner follow-up
with DCO-signed commit 8433cfe.

  • Generate and reference a distinct Version component even at maxversions: 1,
    with a string versionid and rejection of Resource navigation fields.
  • Use Version metadata for metadata-only Resource POST requests and 201
    responses, for declared and imported Resource types. Document-bearing POST
    references and media types remain unchanged.

Both regression groups failed before their respective fixes: eight cases each.
The scoped generator suite now passes 53 tests; the full tools suite passes
96 tests, with four existing validator deprecation warnings:

$env:PYTHONDONTWRITEBYTECODE = "1"
$env:PYTEST_DISABLE_PLUGIN_AUTOLOAD = "1"
python -B -m pytest tools -q --tb=short `
    -p no:cacheprovider -p pytest_asyncio.plugin

The installed asyncio plugin is loaded explicitly because autoload is disabled.
The existing generator regenerated the four affected released OpenAPI files.
This forward commit changes seven files; GitHub reports 20 files cumulatively,
and the PR remains draft. Existing requiredness, prior Avro/Core metadata
fixes, and independently tracked OpenAPI/generator issues are unchanged.
The existing PR body, including Fixes xregistry/spec#573, is preserved.

@marcschier

Copy link
Copy Markdown
Contributor Author

Selected feedback addressed at 5e8c98a

Applied the findings retained in your edited feedback with signed forward commits.

Finding Action taken
574-S1 Restored modeled default-Version fields and wildcard values in the Avro and JSON Structure Resource projections, preserving separate record ownership and overlays. Resource copies remain optional for cross-references; Version requirements and present-value types remain enforced.
574-S2 Admitted Resource documents without versions-navigation members while preserving nested-value checks and completed OpenAPI response requirements.
F574-B1, F-FMT-1 Kept a short README compatibility warning, moved detailed changes to unreleased notes, and wrapped the affected prose.
E-574-01 Clarified the historical verification head and the 83ef18a..2b23699 comparison; no general description rewrite.

E-ALL-01 remains informational: no issue-state change was requested or made. JSON Structure evidence concerns the emitted contract, not full native SDK certification.

Behavioral evidence: test_avro_resource_record_round_trips_its_default_version_values, test_avro_resource_record_admits_a_cross_referenced_resource, test_schema_model_avro_resource_keeps_format_and_extensions, test_jsonstructure_resource_keeps_modelled_default_version_attributes, test_jsonstructure_resource_requires_nothing_a_cross_reference_omits, test_jsonschema_document_admits_resources_without_versions_navigation, test_openapi_resource_response_keeps_versions_navigation_requirement.

Current-head hosted verify and DCO passed. The PR remains unmerged.

The generated OpenAPI document routes advertised obsolete 'resource-*' wire header names and query parameters, a serialized 'resource-labels' aggregate, and no redirect, creation or non-JSON write contracts.

Project the current Core HTTP metadata onto 'xRegistry-<SINGULAR>id',
'xRegistry-versionid' and the remaining scalar headers, using the Resource's
effective singular for imported Resources and keeping Resource-level
navigation out of Version serializations. Map attributes are described as a
per-key header family, 'contenttype' stays on the native 'Content-Type'
media contract, and document bytes, 'meta' and 'versions' are never headers.
Document writes take the permitted metadata as optional header parameters
instead of the removed 'resource-*' query carriers.

Add the Core status and location contracts: GET and PUT answer 303 with
Location and no document body, PUT answers 201 with the created entity's
Location, creation and update responses carry Content-Location, and a
content-bearing PUT success also offers the binary document media type.
Metadata-only Resources gain the creation contract but are never redirected,
and 'details' and 'meta' routes stay metadata-only. Location,
Content-Location and Content-Disposition keep their native grammars.

Remove the now unreferenced legacy components, regenerate the four affected
OpenAPI artifacts, and add regressions over declared and imported Resources,
singleton and multi-Version Resources, and raw JSON and binary documents.

Refs: xregistry#721
Signed-off-by: Marc Schier <marcschier@hotmail.com>
Replace stale owning-array enum lookup with Core item.enum lookup for array/map values. Preserve strict/advisory behavior and owner-qualified Avro enums while retaining all existing Core metadata/API fixes. The real Endpoint regression failed for JSON Schema, OpenAPI and Avro before this change; all twelve strict/default/advisory cases and the complete tool suite now pass. Regenerate all sixteen artifacts from merged sources.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Merge accepted upstream model and HTTP-template corrections. Keep the Core-conformance generator and regenerate the conflicting Endpoint and CloudEvents Avro schemas from the current Endpoint model, including REQUIRED usage and the item enum. All 16 artifacts reproduce and 332 tools tests pass.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Incorporate the accepted pagination_noncollection error from upstream without changing this PR's proposals.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
"type": "string",
"format": "uri",
"format": "uri-reference",
"pattern": "^/",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove "pattern"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the ^/ pattern from the shared XID mapping in schema-generator.py and regenerated the affected JSON Schema/OpenAPI artifacts in cdf15ad. This applies consistently to dataschemaxid and other emitted XID fields; it is not a manual edit to the generated file. The string type and URI-reference format remain.

}
]
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove this and then add the opposite below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The property definition was moved to the enclosing properties object, not removed. The three positive required alternatives still select schema, schemabase64, or schemaurl. The added not alternative is the fourth, disjoint case: none of those fields is present.

The old schema required exactly one carrier and rejected metadata-only Versions. Core lines 3654–3667 say the embedded document fields do not appear by default and that at most one of the three carriers can appear. The new alternatives therefore allow zero or one, not the opposite requirement.

For example, {"format":"JSONSchema/draft-07"} now passes without an inlined document. Each single-carrier form still passes; all forms containing two or three carriers still fail. I checked all eight presence combinations against the actual before/after generated Version schemas. No additional change is needed for this point.

Merge accepted basemessage and Endpoint messagegroups target corrections. Resolve all generated-schema conflicts by regeneration from this branch generator and update the existing Avro assertion to the accepted basemessage name.16 artifact recipes reproduce;332 existing tools tests pass.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Signed-off-by: Marc Schier <marcschier@hotmail.com>
marcschier and others added 4 commits November 6, 2026 14:20
Signed-off-by: Marc Schier <marcschier@hotmail.com>

# Conflicts:
#	cloudevents/schemas/document-schema.avsc
#	cloudevents/schemas/document-schema.json
#	cloudevents/schemas/openapi.json
#	endpoint/schemas/document-schema.avsc
#	endpoint/schemas/openapi.json
#	message/schemas/openapi.json
#	schema/schemas/document-schema.json
#	schema/schemas/openapi.json
#	tools/schema-generator.py
Signed-off-by: Marc Schier <marcschier@hotmail.com>
Signed-off-by: Marc Schier <marcschier@hotmail.com>

# Conflicts:
#	cloudevents/schemas/document-schema.struct.json
#	endpoint/schemas/document-schema.struct.json
#	message/schemas/document-schema.struct.json
#	schema/schemas/document-schema.struct.json
#	tools/schema-generator.py
@marcschier
marcschier marked this pull request as draft November 20, 2026 15:01
Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier marcschier closed this Nov 24, 2026
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.

Schema generator emits invalid Avro and nonconforming Core metadata/API schemas

2 participants