Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions changelog.d/core-references-into-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- **Core's four references are declared in data in every port.** `relationship.* @objectRef`,
`identity.reference @references` and `field.object` / `field.map @objectRef` now carry the
reference facet (`ref`) in `spec/metamodel/relationship.json`, `identity.json` and `field.json`,
and every port (TypeScript, C#, Java and Kotlin, Python, Rust) reads them from there instead of
declaring them in its own code. Each keeps its error code (`ERR_INVALID_RELATIONSHIP`,
`ERR_INVALID_REFERENCE`, `ERR_UNRESOLVED_OBJECT_REF`), so a model of core types loads, and
fails, exactly as before. An extension subtype that inherits a core type's reference attribute
now gets the same reference check, which it did not before: a provider subtype that takes
`relationship.base`'s `@objectRef` (in TypeScript, through `extendsBase`) raises
`ERR_INVALID_RELATIONSHIP` for a dangling target, and in Java a custom subtype inheriting
`relationship.base`, `field.object`, `field.map` or `identity.reference` raises that type's code
on every registry path. The registry manifest
(`fixtures/registry-conformance/expected-registry.json`) now writes `ref` on those seven
attributes; `metamodelVersion` does not move.
25 changes: 12 additions & 13 deletions changelog.d/csharp-reference-facet.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
- **The C# loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of
a provider definition, `spec/metamodel-definitions.md`), matching the TypeScript loader: the
spec reader validates the facet and carries it to `AttrSchema.Ref`, the lookup is typed by the
target, a dotted value resolves `System.child` and `pkg::System.child`, a bare value is looked
for in the referrer's own containers first, and a value that names nothing
(`ERR_REF_UNRESOLVED`), the wrong kind of node (`ERR_REF_WRONG_KIND`) or a node of another
system (the facet's own code) is refused. A canonical value is the path the lookup walked, and
a value whose canonical spelling would not look up the same target is kept as written. The
registry manifest writes `ref` only on an attribute that has one. No definition file uses the
facet yet, so no registry, manifest or generated output changes. A provider's own code that is
not an `ErrorCode` member now keeps its spelling in `MetaError.ProviderCode` (`Code` stays
`ERR_UNKNOWN`; `CodeName` gives either). A parent-relative `@references` value
(`..::Address.id`) now resolves its owner instead of reading the `..` as one.
- **The C# loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of a
provider definition, `spec/metamodel-definitions.md`), matching the TypeScript loader: the spec
reader validates the facet and carries it to `AttrSchema.Ref`, the lookup is typed by the target,
a dotted value resolves `System.child` and `pkg::System.child`, a bare value is looked for in the
referrer's own containers first, and a value that names nothing (`ERR_REF_UNRESOLVED`), the wrong
kind of node (`ERR_REF_WRONG_KIND`) or a node of another system (the facet's own code) is
refused. A canonical value is the path the lookup walked, and a value whose canonical spelling
would not look up the same target is kept as written. The registry manifest writes `ref` only on
an attribute that has one. A provider's own code that is not an `ErrorCode` member now keeps its
spelling in `MetaError.ProviderCode` (`Code` stays `ERR_UNKNOWN`; `CodeName` gives either). A
parent-relative `@references` value (`..::Address.id`) now resolves its owner instead of reading
the `..` as one.

Upgrading: C# `ReferenceDescriptor` is now `(Attr, Facet)`. A provider that sets
`TypeDefinition.References` in code builds `new ReferenceDescriptor(attr, new ReferenceFacet(...))`.
Expand Down
32 changes: 15 additions & 17 deletions changelog.d/java-reference-facet.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
- **The Java loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of
a provider definition, `spec/metamodel-definitions.md`), matching the TypeScript and C#
loaders; Kotlin runs on it. The spec reader validates the facet and carries it to the attr's
`ChildRequirement.getRef()` (or `CommonAttributeDef.ref()`). The lookup is typed by the target.
A dotted value resolves `System.child` and `pkg::System.child`, and a bare value is looked for
in the referrer's own containers first. A value that names nothing (`ERR_REF_UNRESOLVED`), the
wrong kind of node (`ERR_REF_WRONG_KIND`) or a node of another system (the facet's own code) is
refused. A canonical value is the path the lookup walked; a value whose canonical spelling
would not look up the same target is kept as written. The registry manifest writes `ref` only
on an attribute that has one. No definition file uses the facet yet, so no registry, manifest
or generated output changes. A provider's own code that is not an `ErrorCode` member now keeps
its spelling in `MetaDataException.getProviderCode()` (`getCode()` stays `ERR_UNKNOWN`;
- **The Java loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of a
provider definition, `spec/metamodel-definitions.md`), matching the TypeScript and C# loaders;
Kotlin runs on it. The spec reader validates the facet and carries it to the attr's
`ChildRequirement.getRef()` (or `CommonAttributeDef.ref()`). The lookup is typed by the target. A
dotted value resolves `System.child` and `pkg::System.child`, and a bare value is looked for in
the referrer's own containers first. A value that names nothing (`ERR_REF_UNRESOLVED`), the wrong
kind of node (`ERR_REF_WRONG_KIND`) or a node of another system (the facet's own code) is
refused. A canonical value is the path the lookup walked; a value whose canonical spelling would
not look up the same target is kept as written. The registry manifest writes `ref` only on an
attribute that has one. A provider's own code that is not an `ErrorCode` member now keeps its
spelling in `MetaDataException.getProviderCode()` (`getCode()` stays `ERR_UNKNOWN`;
`getCodeName()` gives either). A parent-relative `@references` value (`..::Address.id`) now
resolves its owner instead of reading the `..` as one. As in TypeScript, an `@objectRef` or
`@references` value whose `..::` climbs above the root package now raises
`ERR_BAD_ATTR_VALUE` instead of the reference's own code, and an inherited one is checked in
the package of the node that declares it, not the inheritor's. A dotted `extends` whose owner is a
top-level node other than an object (`acme::Parcels.base`) now resolves, as it does in
TypeScript and C#.
`@references` value whose `..::` climbs above the root package now raises `ERR_BAD_ATTR_VALUE`
instead of the reference's own code, and an inherited one is checked in the package of the node
that declares it, not the inheritor's. A dotted `extends` whose owner is a top-level node other
than an object (`acme::Parcels.base`) now resolves, as it does in TypeScript and C#.

Upgrading: Java `ReferenceDescriptor` is now `(attr, facet)`. A provider that attaches
references to its type definition in code builds
Expand Down
21 changes: 10 additions & 11 deletions changelog.d/python-reference-facet.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
- **The Python loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry
of a provider definition, `spec/metamodel-definitions.md`), matching the TypeScript and C#
loaders: the spec reader validates the facet and carries it to `AttrSchema.ref`, the lookup is
typed by the target, a dotted value resolves `System.child` and `pkg::System.child`, a bare
value is looked for in the referrer's own containers first, and a value that names nothing
(`ERR_REF_UNRESOLVED`), the wrong kind of node (`ERR_REF_WRONG_KIND`) or a node of another
system (the facet's own code) is refused. A canonical value is the path the lookup walked, and
a value whose canonical spelling would not look up the same target is kept as written. The
registry manifest writes `ref` only on an attribute that has one. No definition file uses the
facet yet, so no registry, manifest or generated output changes. A provider's own code that is
not an `ErrorCode` member now keeps its spelling in `MetaError.provider_code` (`code` stays
- **The Python loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of
a provider definition, `spec/metamodel-definitions.md`), matching the TypeScript and C# loaders:
the spec reader validates the facet and carries it to `AttrSchema.ref`, the lookup is typed by
the target, a dotted value resolves `System.child` and `pkg::System.child`, a bare value is
looked for in the referrer's own containers first, and a value that names nothing
(`ERR_REF_UNRESOLVED`), the wrong kind of node (`ERR_REF_WRONG_KIND`) or a node of another system
(the facet's own code) is refused. A canonical value is the path the lookup walked, and a value
whose canonical spelling would not look up the same target is kept as written. The registry
manifest writes `ref` only on an attribute that has one. A provider's own code that is not an
`ErrorCode` member now keeps its spelling in `MetaError.provider_code` (`code` stays
`ERR_UNKNOWN`; `code_name` gives either), and the CLI and `build_shared_model` report that
spelling.

Expand Down
33 changes: 16 additions & 17 deletions changelog.d/rust-reference-facet.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
- **The Rust loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of
a provider definition, `spec/metamodel-definitions.md`), matching the TypeScript, C# and Java
loaders. The spec reader in `providers.rs` validates the facet (refusing a bad facet, or one on
a structural child) and carries it to `AttrSchema::reference`. The registered walk enforces it
- **The Rust loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry of a
provider definition, `spec/metamodel-definitions.md`), matching the TypeScript, C# and Java
loaders. The spec reader in `providers.rs` validates the facet (refusing a bad facet, or one on a
structural child) and carries it to `AttrSchema::reference`. The registered walk enforces it
through a kind-typed symbol table: a dotted value resolves `System.child` and
`pkg::System.child`, a bare value is looked for in the referrer's own containers first, and a
value that names nothing (`ERR_REF_UNRESOLVED`), the wrong kind of node (`ERR_REF_WRONG_KIND`)
or a node of another system (the facet's own code) is refused, with `sameSystem` judged on the
path the lookup walked. The reference pass writes a canonical value as that walked path, and
keeps a value as written when its canonical spelling would not look up the same target. The
registry manifest writes `ref` only on an attribute that has one. No definition file uses the
facet yet, so no registry, manifest or generated output changes. A provider's own code that is
not in the shared catalogue keeps its spelling in `MetaError::provider_code` (`code` stays
`ERR_UNKNOWN`; `MetaError::code_name()` gives either, and the error prints under it). A
parent-relative `@references` value (`..::Address.id`) now resolves its owner instead of
reading the `..` as one. A root-level node and a same-named node in a package, declared in one
document, are now two nodes rather than one merged node, as in every other port and the
loader's cross-file merge; this closes the last ledgered `yaml-conformance` fixture
(`yaml-ref-root-escape`), so Rust passes 19 of 19.
value that names nothing (`ERR_REF_UNRESOLVED`), the wrong kind of node (`ERR_REF_WRONG_KIND`) or
a node of another system (the facet's own code) is refused, with `sameSystem` judged on the path
the lookup walked. The reference pass writes a canonical value as that walked path, and keeps a
value as written when its canonical spelling would not look up the same target. The registry
manifest writes `ref` only on an attribute that has one. A provider's own code that is not in the
shared catalogue keeps its spelling in `MetaError::provider_code` (`code` stays `ERR_UNKNOWN`;
`MetaError::code_name()` gives either, and the error prints under it). A parent-relative
`@references` value (`..::Address.id`) now resolves its owner instead of reading the `..` as one.
A root-level node and a same-named node in a package, declared in one document, are now two nodes
rather than one merged node, as in every other port and the loader's cross-file merge; this
closes the last ledgered `yaml-conformance` fixture (`yaml-ref-root-escape`), so Rust passes 19
of 19.

Upgrading: Rust `ReferenceDescriptor` is now `{ attr, facet }`. A provider that sets
`TypeDefinition::references` in code builds `ReferenceDescriptor { attr, facet: ReferenceFacet { .. } }`,
Expand Down
11 changes: 5 additions & 6 deletions changelog.d/typescript-reference-facet-reader.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
- **The TypeScript loader reads and enforces the reference facet** (`ref` on a `type: "attr"`
entry of a provider definition, `spec/metamodel-definitions.md`). A reference attribute can now
say in data what it may name (target type, admitted subtypes, same system), and the loader
checks it with no code per provider: the lookup is typed by the target, a dotted value resolves
- **The TypeScript loader reads and enforces the reference facet** (`ref` on a `type: "attr"` entry
of a provider definition, `spec/metamodel-definitions.md`). A reference attribute can now say in
data what it may name (target type, admitted subtypes, same system), and the loader checks it
with no code per provider: the lookup is typed by the target, a dotted value resolves
`System.child` and `pkg::System.child`, a bare value is looked for in the referrer's own
containers first, and a value that names nothing (`ERR_REF_UNRESOLVED`), the wrong kind of node
(`ERR_REF_WRONG_KIND`) or a node of another system (the facet's own code) is refused. The
registry manifest writes `ref` only on an attribute that has one. The two default codes are in
`fixtures/conformance/ERROR-CODES.json` and in the TypeScript, Python, Java and C# error-code
catalogs. No definition file uses the facet yet, so no registry, manifest or generated output
changes. A provider that sets `TypeDefinition.references` in code: the descriptor's
catalogs. A provider that sets `TypeDefinition.references` in code: the descriptor's
`targetSubType` is now `targetSubTypes` (a list), `dottedFieldPath` is now `fieldPath`, and
`errorCode` is optional.
6 changes: 4 additions & 2 deletions fixtures/registry-conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,10 @@ still fails everywhere.
An attr whose definition entry carries the reference facet (`spec/metamodel-definitions.md`)
carries `"ref"` in the manifest, after any `ports` and before `description`: `targetType`, then
`targetSubTypes` (sorted), `fieldPath` and `sameSystem` (only when `true`), `errorCode` and
`wrongSystemCode` (only when present). An attr with no facet writes no `ref`, so the canonical
does not change until a definition file uses one.
`wrongSystemCode` (only when present). An attr with no facet writes no `ref`. In the core
definitions the facet is on core's four older references (`relationship.* @objectRef`,
`identity.reference @references`, `field.object` and `field.map @objectRef`), each naming its
existing error code.

### EXCLUDED from v1 — deferred follow-ons (documented, not silent)

Expand Down
29 changes: 29 additions & 0 deletions fixtures/registry-conformance/expected-registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_UNRESOLVED_OBJECT_REF"
},
"description": "Name (or FQN) of the value-object for a value-object-valued map. Mutually exclusive with @valueType; exactly one of the two must be set."
},
{
Expand Down Expand Up @@ -2225,6 +2229,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_UNRESOLVED_OBJECT_REF"
},
"description": "Name (or FQN) of the target object an object-typed field nests — drives nested-object (de)serialization."
},
{
Expand Down Expand Up @@ -3146,6 +3154,11 @@
"valueType": "string",
"isArray": false,
"required": true,
"ref": {
"targetType": "object",
"fieldPath": true,
"errorCode": "ERR_INVALID_REFERENCE"
},
"description": "Target of the reference. Bare entity name (e.g. 'Program') resolves to that entity's primary identity. Dotted forms ('Program.id' or 'Program.fieldA,fieldB') target an explicit field set on the entity."
}
],
Expand Down Expand Up @@ -4425,6 +4438,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_INVALID_RELATIONSHIP"
},
"description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
},
{
Expand Down Expand Up @@ -4496,6 +4513,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_INVALID_RELATIONSHIP"
},
"description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
},
{
Expand Down Expand Up @@ -4566,6 +4587,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_INVALID_RELATIONSHIP"
},
"description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
},
{
Expand Down Expand Up @@ -4637,6 +4662,10 @@
"valueType": "string",
"isArray": false,
"required": false,
"ref": {
"targetType": "object",
"errorCode": "ERR_INVALID_RELATIONSHIP"
},
"description": "Name or fully-qualified name of the target object the relationship points to (e.g. 'Week' or 'acme::vehicle::Car')."
},
{
Expand Down
Loading
Loading