Skip to content

Instantly share code, notes, and snippets.

@soyuka
Created February 10, 2025 14:57
Show Gist options
  • Save soyuka/f4030df32b67d7f4f1d1c53e695442c3 to your computer and use it in GitHub Desktop.
Save soyuka/f4030df32b67d7f4f1d1c53e695442c3 to your computer and use it in GitHub Desktop.
Hydra collection schema API Platform
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"definitions": {
"Dummy": {
"type": "object",
"description": "Dummy.",
"properties": {
"id": {
"readOnly": true,
"description": "The id",
"type": [
"integer",
"null"
]
},
"name": {
"description": "The dummy name",
"type": "string"
},
"alias": {
"description": "The dummy name alias",
"type": [
"string",
"null"
]
},
"foo": {
"description": "foo",
"type": "array",
"items": {
"type": "string"
}
},
"description": {
"description": "A short description of the item",
"type": [
"string",
"null"
]
},
"dummy": {
"description": "A dummy",
"type": [
"string",
"null"
]
},
"dummyBoolean": {
"description": "A dummy boolean",
"type": [
"boolean",
"null"
]
},
"dummyDate": {
"description": "A dummy date",
"type": [
"string",
"null"
],
"format": "date-time"
},
"dummyFloat": {
"description": "A dummy float",
"type": [
"number",
"null"
]
},
"dummyPrice": {
"description": "A dummy price",
"type": [
"string",
"null"
]
},
"relatedDummy": {
"type": [
"string",
"null"
],
"format": "iri-reference",
"example": "https://example.com/"
},
"relatedDummies": {
"type": "array",
"items": {
"type": "string",
"format": "iri-reference",
"example": "https://example.com/"
}
},
"jsonData": {
"description": "serialize data",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"arrayData": {
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"name_converted": {
"type": [
"string",
"null"
]
},
"relatedOwnedDummy": {
"type": [
"string",
"null"
],
"format": "iri-reference",
"example": "https://example.com/"
},
"relatedOwningDummy": {
"type": [
"string",
"null"
],
"format": "iri-reference",
"example": "https://example.com/"
}
},
"required": [
"name"
]
},
"Dummy.jsonld": {
"allOf": [
{
"type": "object",
"properties": {
"@id": {
"readOnly": true,
"type": "string"
},
"@type": {
"readOnly": true,
"type": "string"
}
}
},
{
"$ref": "#/definitions/Dummy"
}
],
"description": "Dummy."
},
"HydraCollectionBaseSchema": {
"type": "object",
"required": [
"hydra:member"
],
"properties": {
"hydra:member": {
"type": "array"
},
"hydra:totalItems": {
"type": "integer",
"minimum": 0
},
"hydra:view": {
"type": "object",
"properties": {
"@id": {
"type": "string",
"format": "iri-reference"
},
"@type": {
"type": "string"
},
"hydra:first": {
"type": "string",
"format": "iri-reference"
},
"hydra:last": {
"type": "string",
"format": "iri-reference"
},
"hydra:previous": {
"type": "string",
"format": "iri-reference"
},
"hydra:next": {
"type": "string",
"format": "iri-reference"
}
},
"example": {
"@id": "string",
"type": "string",
"hydra:first": "string",
"hydra:last": "string",
"hydra:previous": "string",
"hydra:next": "string"
}
},
"hydra:search": {
"type": "object",
"properties": {
"@type": {
"type": "string"
},
"hydra:template": {
"type": "string"
},
"hydra:variableRepresentation": {
"type": "string"
},
"hydra:mapping": {
"type": "array",
"items": {
"type": "object",
"properties": {
"@type": {
"type": "string"
},
"variable": {
"type": "string"
},
"property": {
"type": [
"string",
"null"
]
},
"required": {
"type": "boolean"
}
}
}
}
}
}
}
}
},
"description": "Dummy.jsonld collection.",
"allOf": [
{
"$ref": "#/definitions/HydraCollectionBaseSchema"
},
{
"type": "object",
"properties": {
"hydra:member": {
"type": "array",
"items": {
"$ref": "#/definitions/Dummy.jsonld"
}
}
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment