Last active
September 10, 2019 08:47
-
-
Save siman/9560655eeea0560f67853250d10f4282 to your computer and use it in GitHub Desktop.
Joystream class JSON schema with example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema", | |
"$id": "TODO: An URL of this schema. Ideally at Joystream.org. Example: https://joystream.org/new-class.schema.json", | |
"title": "JoystreamNewClass", | |
"description": "JSON schema to describe a new class for Joystream network", | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"name" | |
], | |
"properties": { | |
"name": { | |
"type": "string", | |
"description": "Name of this class. Required property." | |
}, | |
"description": { | |
"type": "string", | |
"description": "Description of this class." | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema", | |
"$id": "TODO: An URL of this schema. Ideally at Joystream.org. Example: https://joystream.org/new-schema.schema.json", | |
"title": "JoystreamNewSchema", | |
"description": "JSON schema to describe a schema for a certain class in Joystream network", | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"classId" | |
], | |
"properties": { | |
"classId": { "$ref": "#/definitions/ClassId" }, | |
"existingProperties": { | |
"type": "array", | |
"minItems": 1, | |
"uniqueItems": true, | |
"items": { "$ref": "#/definitions/PropertyName" } | |
}, | |
"newProperties": { | |
"type": "array", | |
"minItems": 1, | |
"uniqueItems": true, | |
"items": { | |
"type": "object", | |
"oneOf": [ | |
{ "$ref": "#/definitions/PrimitiveProperty" }, | |
{ "$ref": "#/definitions/TextProperty" }, | |
{ "$ref": "#/definitions/VecProperty" }, | |
{ "$ref": "#/definitions/TextVecProperty" }, | |
{ "$ref": "#/definitions/InternalProperty" }, | |
{ "$ref": "#/definitions/InternalVecProperty" } | |
] | |
} | |
} | |
}, | |
"definitions": { | |
"PropertyName": { | |
"type": "string", | |
"minLength": 1, | |
"maxLength": 100 | |
}, | |
"PropertyDescription": { | |
"type": "string", | |
"minLength": 1 | |
}, | |
"PropertyRequired": { | |
"type": "boolean", | |
"default": false | |
}, | |
"MaxVecItems": { | |
"type": "integer", | |
"minimum": 1, | |
"maximum": 65535 | |
}, | |
"MaxTextLength": { | |
"type": "integer", | |
"minimum": 1, | |
"maximum": 65535 | |
}, | |
"ClassId": { | |
"type": "integer", | |
"minimum": 1 | |
}, | |
"PrimitiveProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"Bool", | |
"Uint16", | |
"Uint32", | |
"Uint64", | |
"Int16", | |
"Int32", | |
"Int64" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" } | |
} | |
}, | |
"TextProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name", | |
"maxTextLength" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"Text" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" }, | |
"maxTextLength": { "$ref": "#/definitions/MaxTextLength" } | |
} | |
}, | |
"InternalProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name", | |
"classId" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"Internal" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" }, | |
"classId": { "$ref": "#/definitions/ClassId" } | |
} | |
}, | |
"VecProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name", | |
"maxItems" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"BoolVec", | |
"Uint16Vec", | |
"Uint32Vec", | |
"Uint64Vec", | |
"Int16Vec", | |
"Int32Vec", | |
"Int64Vec" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" }, | |
"maxItems": { "$ref": "#/definitions/MaxVecItems" } | |
} | |
}, | |
"TextVecProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name", | |
"maxItems", | |
"maxTextLength" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"TextVec" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" }, | |
"maxItems": { "$ref": "#/definitions/MaxVecItems" }, | |
"maxTextLength": { "$ref": "#/definitions/MaxTextLength" } | |
} | |
}, | |
"InternalVecProperty": { | |
"type": "object", | |
"additionalProperties": false, | |
"required": [ | |
"type", | |
"name", | |
"maxItems", | |
"classId" | |
], | |
"properties": { | |
"type": { | |
"enum": [ | |
"InternalVec" | |
] | |
}, | |
"name": { "$ref": "#/definitions/PropertyName" }, | |
"description": { "$ref": "#/definitions/PropertyDescription" }, | |
"required": { "$ref": "#/definitions/PropertyRequired" }, | |
"maxItems": { "$ref": "#/definitions/MaxVecItems" }, | |
"classId": { "$ref": "#/definitions/ClassId" } | |
} | |
} | |
} | |
} |
"New class" example:
{
"name": "PodcastChannel",
"description": "A description of a podcast channel."
}
"New schema" example:
{
"classId": 123,
"existingProperties": [
"abc",
"someOldProp"
],
"newProperties": [
{
"name": "title",
"type": "Text",
"required": true,
"maxTextLength": 100
},
{
"name": "itunes:title",
"type": "Text",
"maxTextLength": 100
},
{
"name": "pubDate",
"type": "Text",
"required": true,
"maxTextLength": 100
},
{
"name": "guid",
"type": "Text",
"maxTextLength": 32
},
{
"name": "link",
"type": "Text",
"maxTextLength": 1000
},
{
"name": "itunes:image",
"type": "Text",
"maxTextLength": 1000
},
{
"name": "description",
"type": "Text",
"maxTextLength": 2000
},
{
"name": "content:encoded",
"type": "Text",
"maxTextLength": 2000
},
{
"name": "enclosure/length",
"type": "Uint64",
"description": "Size of this episode in bytes. Example: 74063411"
},
{
"name": "enclosure/type",
"type": "Text",
"maxTextLength": 50,
"description": "Example: 'audio/mpeg'"
},
{
"name": "enclosure/url",
"type": "Text",
"maxTextLength": 1000,
"description": "URL of the actual content."
},
{
"name": "itunes:duration",
"type": "Text",
"maxTextLength": 20,
"description": "Example: '30:52'"
},
{
"name": "itunes:explicit",
"type": "Text",
"maxTextLength": 10
},
{
"name": "itunes:keywords",
"type": "TextVec",
"maxItems": 20,
"maxTextLength": 50
},
{
"name": "itunes:subtitle",
"type": "Text",
"maxTextLength": 100
},
{
"name": "itunes:summary",
"type": "Text",
"maxTextLength": 2000
},
{
"name": "itunes:season",
"type": "Uint16"
},
{
"name": "itunes:episode",
"type": "Uint16"
},
{
"name": "itunes:episodeType",
"type": "Text",
"maxTextLength": 20,
"description": "Example: 'full'"
},
{
"name": "itunes:author",
"type": "Text",
"maxTextLength": 100
}
]
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can go to this site and copy-paste this schema with the example to validate it.