Skip to content

proposal(schema): define projection, root and selector profiles - #656

Closed
marcschier wants to merge 20 commits into
xregistry:mainfrom
marcschier:fix/lossless-scalar-projections
Closed

marcschier wants to merge 20 commits into
xregistry:mainfrom
marcschier:fix/lossless-scalar-projections

Conversation

@marcschier

@marcschier marcschier commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Current-main refresh

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

The new Endpoint item-level enum source and upstream example ordering are retained. All sixteen artifacts were regenerated with this branch's scalar profile and independently reproduced; all 407 tools tests pass. The lossless carrier, native-root and selector contracts remain proposals; this update does not import another unmerged PR's generator or treat its extra capabilities as mainline behavior.

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


Proposed Changes

This PR addresses review feedback regarding Schema documents and scalar projections: The existing lossless scalar proposal, native schema-root admission and object selector profiles.

Normative corrections and decisions

  • Scalar profile: the lossless physical carriers, schema-bound readers and
    writers, full contract identity and explicit migration limits remain an
    unapproved derived-artifact contract, not a change to Core wire numeric kinds.
  • Native roots and selectors: supported schema formats retain their native
    root categories; selector behavior is defined separately from those roots.
  • The six existing artifact-oriented Python files retain their paths and import
    relationships. Generated output is derived from the actual branch's models,
    generator and profile, never selected from stale merge sides.
  • Independent tooling corrections in Fix xRegistry model include precedence, validation, and OpenAPI contracts #724 remain separate.

Native schema-root admission and selector profiles are composed without restoring object-only restrictions. Core wire scalar types, generated profile carriers and native schema document roots remain distinct concepts.

Issue721 owner/selector consistency (W13)

Commit acc07edc adds the #721 W13 proposal to the Message
dataschemauri/dataschemaxid wording and the related model description.
Consistency compares the exact resolved owning Schema Resource or Version;
the format-defined object selected inside that document is checked separately.
An explicit Version owner is not interchangeable with its Resource merely
because that Version is currently default. Matching a selector also does not
equate different Registries or Schema entities.

The text links the existing selector rules instead of repeating them.
Consumers using literal metadata-self equality must distinguish ownership,
retrieval semantics and object selection; indiscriminate fragment or colon
stripping is not a migration strategy.

The corresponding description-derived artifacts were regenerated from this
branch. No model type, target or constraint changed, and W13 adds no Python
resolver, server validation, policy simulator or prose-string tests. The owner
comparison cases are normative review, not executable client/server conformance
evidence. The existing real scalar codec and artifact tests remain part of the
separate projection proposal, with its explicit compatibility limits.

This proposal PR combines 3 independent PRs which are superseded:

Original PR / discussion Source scope
#656 fix(schemas): lossless numeric and timestamp projections; Keeper history retained.
#692 fix(schema): admit native schema root categories.
#713 fix(schema): specify schema object selector profiles.

The representation/profile contract remains a separate proposal requiring compatibility and migration review. The independent decimal/epoch tooling fixes are in #724.

Fixes #645 #653 #651

Add a versioned semantic profile for exact JSON number tokens and complete
RFC3339 timestamps, using standard Avro strings and JSON Structure types.
Keep Core JSON numeric kinds and preserve source/default constraint values.

Provide typed recursive readers/writers, immutable complete writer-schema
identity, explicit presence states, and real legacy reader migrations.
Require authoritative re-encoding when old data has lost information.

Regenerate all 16 affected released outputs with the existing generator.
This scalar-only fix is independent of the separate PR 574 changes.

Fixes xregistry#645

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Express the same JSON number grammar in prose so the repository link checker does not treat adjacent regex character classes as undefined Markdown bookmarks. No encoding or test behavior changes.

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

Copy link
Copy Markdown
Contributor Author

Documentation-only follow-up f6d89bd fixes the link checker interpreting regex character classes as Markdown bookmarks. The first hosted run already passed all 375 tests; the exact repository document/link checker passes after this correction. No encoding, schema, or test behavior changed. The PR remains draft and scoped to #645.

Validate JSON Structure map limits before write and after read, including referenced contracts. Require authoritative Core data for legacy object-to-map migration, including empty values.

Refs xregistry#645

Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier
marcschier marked this pull request as ready for review September 15, 2026 06:50
@marcschier
marcschier marked this pull request as draft September 15, 2026 08:40
Signed-off-by: Marc Schier <marcschier@hotmail.com>
Signed-off-by: Marc Schier <marcschier@hotmail.com>
Forward-merge xregistry/spec main at 9ecf8ea into the cleaned xregistry#656 keeper at 9fae446. Preserve all incoming sample, Core model and Protobuf separator changes and the complete unapproved scalar profile. No unmerged 574 or A/B/C source is imported.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Transfer only the cleaned net diff from xregistry#692 at 84b1f9f, based on main 9ecf8ea. Preserve native JSON Schema boolean roots and Avro string/union roots before composing object selectors. This remains an unapproved proposal; removed policy checks are not restored.

Refs: xregistry#653
Signed-off-by: Marc Schier <marcschier@hotmail.com>
Transfer only the cleaned net diff from xregistry#713 at 9257064, based on main 9ecf8ea. All added and removed patch lines are preserved, with context relocated around the native roots already transferred from xregistry#692. Preserve main Protobuf separators and the separate unapproved scalar proposal. No removed policy fixtures are restored.

Refs: xregistry#651
Signed-off-by: Marc Schier <marcschier@hotmail.com>
@marcschier marcschier changed the title fix(schemas): lossless numeric and timestamp projections proposal(schema): define projection, root and selector profiles Sep 16, 2026
@marcschier
marcschier marked this pull request as ready for review September 16, 2026 11:26
@marcschier

marcschier commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Review feedback at c61264b

Independent read-only review against main 9ecf8ea using the three-dot diff. Every finding cites the changed text and the authority it was checked against. The review changed nothing in this PR.

Criterion Verdict
(a) Repetition a link would replace opportunity
(b) Understandable, not verbose opportunity
(c) Correct per spec/standard pass
(d) Nothing invented, defensible pass
(e) Description matches content SUBSTANTIALLY ACCURATE, two low findings (F5, F8)

Findings: 0 correctness, 3 prose, 3 description.

(a)/(b) Repetition and clarity

F656-A1 — low — criterion (a), judgement

  • Added text: schema/spec.md:521-715 — “521: 'selecting a non-schema value or a location that does not exist is an error'; 592-596: 'A scalar result, a different kind of node, or zero or multiple matching declarations is an error'; 656-658: 'A missing or ambiguous name is an error; no namespace or first union branch is guessed'; 714-715: 'Partial suffix matching, choosing the first message, and guessing a package are not permitted. Missing or ambiguous na…”
  • Already stated in: schema/spec.md 826-829 (same head, section 4.3.6 Schem… — “When the needed information is available, a missing, invalid or ambiguous target is an error, not permission to choose another object or a different Version.”
  • Why: The PR creates section 4.3.6 as the common home for selection semantics and then still repeats its central rule - missing or ambiguous target is an error, nothing is guessed - in each of the four per-format sections. The four copies differ in wording and in what they enumerate ('no namespace or first union branch', 'partial suffix matching, choosing the first message, guessing a package'), which is exactly the divergence a shared section is meant to prevent; a reader comparing two formats cannot tell whether the differences are deliberate.
  • Link instead: State the rule once in 4.3.6 and have each format section point at it, e.g. 'Missing, invalid and ambiguous selectors are handled as defined in [Schema Object…
  • Keep locally: Format-specific resolution detail that 4.3.6 cannot carry: Avro full-name matching, the unqualified-name uniqueness rule and the exclusion of aliases; Protobuf's optional leading . and package/enclosing-message qualification; the XSD requirement that the result be exactly one element/simple-type/complex-type node; the JSON Schema rule that the target must itself be a schema.
  • Suggested change: Keep the no-guessing rule in 4.3.6 and reduce the per-format sections to their own name-resolution specifics plus a reference.

F656-B1 — low — criterion (b), judgement

  • Added text: README.md:71-75 — “Numeric and timestamp values in derived Avro and JSON Structure schemas use the lossless scalar projection profile. Consumers need its semantic reader/writer adapters and explicit schema migration; Core JSON numeric values remain numbers.”
  • Why: The second sentence is the reader's only warning of a breaking change to generated types, but it is stated in the profile document's own vocabulary ('semantic reader/writer adapters', 'explicit schema migration'), none of which is defined on the page. A reader of the README cannot determine what actually changed - that numbers and timestamps are now carried as strings in the derived schemas - without opening the 271-line profile.
  • Suggested change: Say what changed before naming the profile: 'In those derived schemas, numeric and timestamp values are carried as strings so that no precision is lost; consumers must convert them back and regenerate their types (see the lossless scalar projection profile). Core JSON keeps numbers as numbers.'

F-FMT-1 — low — criterion (formatting (docs/CONTRIBUTING.md:120)), hard (also affects PRs 574,656,677,685,689,724)

  • Added text: multiple — “574 README.md:81 (82 cols) 'generated qualified names and layouts. Regenerate bindings and check writer/reader'; 574 README.md:89 (81); 656 schema/spec.md:595 (81) 'under its schema element; otherwise an explicit selector MUST be supplied. This'; 656 tools/schema-projection-profile.md:10 (86, words-comment); 677 core/spec.md:3667 (81) 'For example, the four document bytes null for a file Resource are represent…”
  • Already stated in: docs/CONTRIBUTING.md 118-120 (baseline 9ecf8ea) — “Documents in this repository will adhere to the following rules: - Lines are wrapped at 80 columns (when possible)”
  • Why: A documented repository standard that the automated checks listed at docs/CONTRIBUTING.md:126-131 do not cover, so nothing else will catch it. All the prose lines listed are 81-82 columns and wrap trivially at a word boundary, so the 'when possible' allowance does not apply to them. Lines inside fenced code blocks, table rows and lines carrying long URLs were excluded from this count. The two <!-- words: ... --> spellcheck directives (656 and 689) are tooling metadata rather than prose and are listed only for completeness. PRs 686, 722 and 723 add no over-length prose lines.
  • Suggested change: Rewrap the listed lines at 80 columns.

…tion

Apply the selected review feedback for xregistry#656.

F656-A1: state the missing/invalid/ambiguous selector failure rule once in
section 4.3.6 and have the JSON Schema, XSD, Avro and Protobuf sections
reference it instead of restating it in four diverging wordings. Each format
keeps its own resolution specifics: the JSON Schema target must itself be a
schema, the XSD result must be exactly one element/simple-type/complex-type
node, Avro full-name matching with unqualified-name uniqueness and no alias
lookup, and Protobuf's optional leading dot with package and enclosing
message qualification.

F656-B1: say plainly in the README that derived Avro and JSON Structure
schemas carry numeric values as exact JSON number token strings and
timestamps as RFC3339 text, so consumers must convert them back and
regenerate their types, before linking the lossless scalar projection
profile. Core JSON numeric values remain numbers.

F-FMT-1: rewrap the affected prose at 80 columns and split the over-long
spellcheck words directive into two valid directive lines.

No normative conformance, scalar projection policy, generator or generated
artifact behaviour changes.

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

Copy link
Copy Markdown
Contributor Author

Selected feedback addressed at d53066d

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

Finding Action taken
F656-A1 Centralized selector failure/no-guessing semantics in section 4.3.6 and linked the four format-specific sections, retaining their distinct resolution rules.
F656-B1 Explained the derived scalar string representations and consumer migration plainly while preserving Core JSON numeric values.
F-FMT-1 Wrapped the affected prose and retained valid spelling directives.

The scalar projection policy, generator, models, artifacts, PR title and description are unchanged.

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

Address W13 of xregistry#721 by comparing the resolved owning Resource or Version, keeping selector resolution separate, and regenerating the directly related model description.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Regenerate and independently reproduce all sixteen artifacts from the merged source models and this branch scalar profile. Preserve upstream item-enum placement, example ordering and validation/workflow changes while keeping the unapproved scalar carriers, native roots and owner/selector proposal separate.

Signed-off-by: Marc Schier <marcschier@hotmail.com>
Merge upstream main while preserving the lossless scalar projection and schema selector proposals. Adopt accepted Endpoint usage requiredness, Message metadata corrections and optional DELETE guards. All 16 artifacts reproduce without additional changes; 407 tools tests and documentation checks 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>
Merge the accepted basemessage and Endpoint Group-target corrections while retaining this PR scalar projection proposal. All16 generated artifacts reproduce and407 existing tools tests pass.

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

# Conflicts:
#	cloudevents/schemas/document-schema.json
#	cloudevents/schemas/openapi.json
#	endpoint/schemas/document-schema.json
#	endpoint/schemas/openapi.json
#	message/schemas/document-schema.json
#	message/schemas/openapi.json
#	schema/spec.md
#	tools/schema-generator.py
Signed-off-by: Marc Schier <marcschier@hotmail.com>
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

1 participant