docs: add v2 schema json

This commit is contained in:
Iain Learmonth 2022-04-08 17:48:07 +01:00
parent b2edcbe1a5
commit c57f072560
5 changed files with 101 additions and 4 deletions

View file

@ -6,7 +6,7 @@ test:
- cp config.yaml.example config.yaml
- apt update && apt install build-essential
- pip install -r requirements.txt
- pip install -U sphinx sphinx-press-theme
- pip install -U sphinx sphinx-press-theme sphinx-jsonschema
- sphinx-build -b html docs public
rules:
- if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
@ -17,7 +17,7 @@ pages:
- cp config.yaml.example config.yaml
- apt update && apt install build-essential
- pip install -r requirements.txt
- pip install -U sphinx sphinx-press-theme
- pip install -U sphinx sphinx-press-theme sphinx-jsonschema
- sphinx-build -b html docs public
artifacts:
paths:

View file

@ -16,7 +16,8 @@ author = 'Bypass Censorship'
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc'
'sphinx.ext.autodoc',
'sphinx-jsonschema'
]
# Add any paths that contain templates here, relative to this directory.

View file

@ -29,6 +29,7 @@ Documentation Home
tech/index.rst
tech/conf.rst
tech/resource.rst
tech/schemas.rst
Indices and tables

8
docs/tech/schemas.rst Normal file
View file

@ -0,0 +1,8 @@
Mirror List Formats
===================
Bypass Censorship Version 2
---------------------------
.. jsonschema:: ../../schemas/bc2.json

87
schemas/bc2.json Normal file
View file

@ -0,0 +1,87 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://bypass.censorship.guide/schema/bc2.json",
"type": "object",
"title": "Bypass Censorship Version 2",
"required": [
"sites",
"version"
],
"properties": {
"sites": {
"$id": "#/properties/sites",
"type": "array",
"title": "The sites schema",
"additionalItems": true,
"items": {
"$id": "#/properties/sites/items",
"type": "object",
"title": "The items schema",
"required": [
"available_alternatives",
"main_domain"
],
"properties": {
"available_alternatives": {
"$id": "#/properties/sites/items/properties/available_alternatives",
"type": "array",
"title": "The available_alternatives schema",
"additionalItems": true,
"items": {
"$id": "#/properties/sites/items/properties/available_alternatives/items",
"type": "object",
"title": "The items schema",
"required": [
"created_at",
"proto",
"type",
"updated_at",
"url"
],
"properties": {
"created_at": {
"$id": "#/properties/sites/items/properties/available_alternatives/items/properties/created_at",
"type": "string",
"title": "The created_at schema"
},
"proto": {
"$id": "#/properties/sites/items/properties/available_alternatives/items/properties/proto",
"type": "string",
"title": "The proto schema"
},
"type": {
"$id": "#/properties/sites/items/properties/available_alternatives/items/properties/type",
"type": "string",
"title": "The type schema"
},
"updated_at": {
"$id": "#/properties/sites/items/properties/available_alternatives/items/properties/updated_at",
"type": "string",
"title": "The updated_at schema"
},
"url": {
"$id": "#/properties/sites/items/properties/available_alternatives/items/properties/url",
"type": "string",
"title": "The url schema"
}
},
"additionalProperties": true
}
},
"main_domain": {
"$id": "#/properties/sites/items/properties/main_domain",
"type": "string",
"title": "The main_domain schema"
}
},
"additionalProperties": true
}
},
"version": {
"$id": "#/properties/version",
"type": "string",
"title": "The version schema"
}
},
"additionalProperties": true
}