Skip to content

Instantly share code, notes, and snippets.

@tedbow
Last active October 5, 2018 15:15
Show Gist options
  • Save tedbow/689d0b20df6c6958204368a53fd5c552 to your computer and use it in GitHub Desktop.
Save tedbow/689d0b20df6c6958204368a53fd5c552 to your computer and use it in GitHub Desktop.
schemata example
{
"$schema":"http://json-schema.org/draft-04/schema#",
"id":"http://d8/schemata/node/article?_format=schema_json&_describes=hal_json",
"type":"object",
"title":"node:article Schema",
"description":"Use articles for time-sensitive content like news, press releases or blog posts.",
"properties":{
"nid":{
"type":"array",
"title":"ID",
"items":{
"type":"object",
"properties":{
"value":{
"type":"integer",
"title":"Integer value"
}
},
"required":[
"value"
]
},
"minItems":1,
"maxItems":1
},
"uuid":{
"type":"array",
"title":"UUID",
"items":{
"type":"object",
"properties":{
"value":{
"type":"string",
"title":"Text value",
"maxLength":128
}
},
"required":[
"value"
]
},
"minItems":1,
"maxItems":1
},
"vid":{
"type":"array",
"title":"Revision ID",
"items":{
"type":"object",
"properties":{
"value":{
"type":"integer",
"title":"Integer value"
}
},
"required":[
"value"
]
},
"minItems":1,
"maxItems":1
},
"langcode":{
"type":"array",
"title":"Language",
"items":{
"type":"object",
"properties":{
"value":{
"type":"string",
"title":"Language code"
},
"language":{
"type":"language_reference",
"title":"Language object",
"description":"The referenced language"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"type":{
"type":"object",
"title":"Content type",
"description":"The referenced entity"
},
"revision_timestamp":{
"type":"array",
"title":"Revision create time",
"description":"The time that the current revision was created.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"number",
"title":"Timestamp value",
"format":"utc-millisec"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"revision_uid":{
"type":"object",
"title":"User",
"description":"The referenced entity"
},
"revision_log":{
"type":"array",
"title":"Revision log message",
"description":"Briefly describe the changes you have made.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"string",
"title":"Text value"
}
},
"required":[
"value"
]
},
"default":[
{
"value":""
}
],
"maxItems":1
},
"status":{
"type":"array",
"title":"Published",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"default":[
{
"value":true
}
],
"maxItems":1
},
"uid":{
"type":"object",
"title":"User",
"description":"The referenced entity"
},
"title":{
"type":"array",
"title":"Title",
"items":{
"type":"object",
"properties":{
"value":{
"type":"string",
"title":"Text value",
"maxLength":255
}
},
"required":[
"value"
]
},
"minItems":1,
"maxItems":1
},
"created":{
"type":"array",
"title":"Authored on",
"description":"The time that the node was created.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"number",
"title":"Timestamp value",
"format":"utc-millisec"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"changed":{
"type":"array",
"title":"Changed",
"description":"The time that the node was last edited.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"number",
"title":"Timestamp value",
"format":"utc-millisec"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"promote":{
"type":"array",
"title":"Promoted to front page",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"default":[
{
"value":true
}
],
"maxItems":1
},
"sticky":{
"type":"array",
"title":"Sticky at top of lists",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"default":[
{
"value":false
}
],
"maxItems":1
},
"default_langcode":{
"type":"array",
"title":"Default translation",
"description":"A flag indicating whether this is the default translation.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"default":[
{
"value":true
}
],
"maxItems":1
},
"revision_default":{
"type":"array",
"title":"Default revision",
"description":"A flag indicating whether this was a default revision when it was saved.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"revision_translation_affected":{
"type":"array",
"title":"Revision translation affected",
"description":"Indicates if the last edit of a translation belongs to current revision.",
"items":{
"type":"object",
"properties":{
"value":{
"type":"boolean",
"title":"Boolean value"
}
},
"required":[
"value"
]
},
"minItems":1,
"maxItems":1
},
"path":{
"type":"array",
"title":"URL alias",
"items":{
"type":"object",
"properties":{
"alias":{
"type":"string",
"title":"Path alias"
},
"pid":{
"type":"integer",
"title":"Path id"
},
"langcode":{
"type":"string",
"title":"Language Code"
}
}
},
"minItems":1,
"maxItems":1
},
"body":{
"type":"array",
"title":"Body",
"items":{
"type":"object",
"properties":{
"value":{
"type":"string",
"title":"Text"
},
"format":{
"type":"string",
"title":"Text format"
},
"summary":{
"type":"string",
"title":"Summary"
}
},
"required":[
"value"
]
},
"maxItems":1
},
"comment":{
"type":"array",
"title":"Comments",
"items":{
"type":"object",
"properties":{
"status":{
"type":"integer",
"title":"Comment status"
},
"cid":{
"type":"integer",
"title":"Last comment ID"
},
"last_comment_timestamp":{
"type":"integer",
"title":"Last comment timestamp",
"description":"The time that the last comment was created."
},
"last_comment_name":{
"type":"string",
"title":"Last comment name",
"description":"The name of the user posting the last comment."
},
"last_comment_uid":{
"type":"integer",
"title":"Last comment user ID"
},
"comment_count":{
"type":"integer",
"title":"Number of comments",
"description":"The number of comments."
}
},
"required":[
"status"
]
},
"default":[
{
"status":2,
"cid":0,
"last_comment_name":null,
"last_comment_timestamp":0,
"last_comment_uid":0,
"comment_count":0
}
],
"maxItems":1
},
"field_image":{
"type":"object",
"title":"File",
"description":"The referenced entity"
},
"field_tags":{
"type":"object",
"title":"Taxonomy term",
"description":"The referenced entity"
},
"_links":{
"title":"HAL Links",
"description":"Object of links with the rels as the keys",
"type":"object",
"properties":{
"self":{
"$ref":"#/definitions/linkObject"
},
"type":{
"$ref":"#/definitions/linkObject"
}
}
}
},
"required":[
"nid",
"uuid",
"vid",
"title",
"revision_translation_affected",
"path"
],
"definitions":{
"linkArray":{
"title":"HAL Link Array",
"description":"An array of linkObjects of the same link relation",
"type":"array",
"items":{
"$ref":"#/definitions/linkObject"
}
},
"linkObject":{
"title":"HAL Link Object",
"description":"An object with link information.",
"type":"object",
"properties":{
"name":{
"title":"Name",
"description":"Name of a resource, link, action, etc.",
"type":"string"
},
"title":{
"title":"Title",
"description":"A title for a resource, link, action, etc.",
"type":"string"
},
"href":{
"title":"HREF",
"description":"A hyperlink URL.",
"type":"string",
"format":"uri"
}
},
"required":[
"href"
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment