-
Notifications
You must be signed in to change notification settings - Fork 1
Add id keyword to objects to state primary IDs #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -1051,6 +1051,36 @@ schema definition, including in type unions. | |||||||||
| `$ref` is NOT permitted in other attributes and MUST NOT be used inside the | ||||||||||
| `type` of the root object. | ||||||||||
|
|
||||||||||
| ### `id` Keyword {#object-id-keyword} | ||||||||||
|
|
||||||||||
| The `id` keyword is only applicable on objects and states the properties that | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. objects and tuples.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| make up the primary ID(s) of the object. Providing more than one ID indicates | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lists the properties, in the role of identifiers, that establish an unambiguous identity of an instance. Providing more than one property reference indicates a composite identity, not a list of alternate identifiers. |
||||||||||
| a composite primary ID, not a list of alternative IDs. | ||||||||||
|
|
||||||||||
| Example: | ||||||||||
|
|
||||||||||
| ~~~ json | ||||||||||
| { | ||||||||||
| "$schema": "https://json-structure.org/meta/core/v0/#", | ||||||||||
| "$id": "https://schemas.vasters.com/TypeName", | ||||||||||
| "definitions": { | ||||||||||
| "Namespace": { | ||||||||||
| "TypeName": { | ||||||||||
| "name": "TypeName", | ||||||||||
| "type": "object", | ||||||||||
| "id": ["ID"], | ||||||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe more explicit:
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "identity " should be clear.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| "properties": { | ||||||||||
| "ID": { "type": "string" } | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
| } | ||||||||||
| ~~~ | ||||||||||
|
|
||||||||||
| The `id` MUST only be used on objects. | ||||||||||
Fannon marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Identity SHOULD be used on object and tuple declarations. I assume the reason why you want to make it mandatory is the association feature, but I think that will just not work when there is no identity and that might be okay.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I only wanted to make the statement that they must only be used on objects, but there they would be optional. I agree, they should be optional. Not every object may need an identity, e.g. value objects.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| The value MUST be an array of property names of the current object. | ||||||||||
|
|
||||||||||
| ### Cross-references {#cross-references} | ||||||||||
|
|
||||||||||
| In JSON Structure documents, the `$schema` keyword references the meta-schema of | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"identity" will be clearer