Skip to content
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

Properties title #77

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ The media type for JSON Siren is `application/vnd.siren+json`.
{
"class": [ "order" ],
"properties": {
"orderNumber": 42,
"itemCount": 3,
"status": "pending"
"orderNumber": {
"title": "Order number",
"value": 42
},
"itemCount": {
"title": "Items ordered",
"value": 3
},
"status": {
"title": "Order status",
"pending"
}
},
"entities": [
{
Expand Down Expand Up @@ -85,7 +94,7 @@ Describes the nature of an entity's content based on the current representation.

####`properties`

A set of key-value pairs that describe the state of an entity. In JSON Siren, this is an object such as `{ "name": "Kevin", "age": 30 }`. Optional.
A set of key-value pairs that describe the state of an entity. In JSON Siren, this can be an object such as `{ "name": "Kevin", "age": 30 }`. If the value is an object, it MUST contain a `title` property for a human-readable description and a `value` property for the actual value. Optional.

####`entities`

Expand Down
27 changes: 27 additions & 0 deletions siren.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
"type": "string"
},
"properties": {
"additionalProperties": {
"anyOf": [
{ "$ref": "#/definitions/PropertyObject" },
{ "$ref": "#/definitions/PropertyValue" }
]
},
"description": "A set of key-value pairs that describe the state of an entity.",
"type": "object"
},
Expand Down Expand Up @@ -271,6 +277,27 @@
}
}
},
"PropertyObject": {
"description": "",
"type": "object",
"required": [
"title",
"value"
],
"properties": {
"title": {
"description": "Textual description of the property. Clients may use this as a label.",
"type": "string"
},
"value": {
"$ref": "#/definitions/PropertyValue"
}
}
},
"PropertyValue": {
"description": "A value assigned to the property.",
"type": [ "array", "boolean", "number", "string" ]
},
"RelValue": {
"anyOf": [
{
Expand Down