Add input validation schema for SignupFormViewSet create

This commit is contained in:
Aarni Halinen
2022-07-28 21:10:21 +03:00
parent dd0254a08e
commit 8bb6e9e9a7
2 changed files with 297 additions and 3 deletions
+291
View File
@@ -0,0 +1,291 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"CheckboxQuestion": {
"properties": {
"id": {
"type": "string"
},
"options": {
"properties": {
"enum": {
"items": {
"type": "string"
},
"type": "array"
},
"enumNames_en": {
"items": {
"type": "string"
},
"type": "array"
},
"enumNames_fi": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"required": {
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"checkbox"
],
"type": "string"
}
},
"type": "object"
},
"EmailQuestion": {
"properties": {
"id": {
"type": "string"
},
"required": {
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"email"
],
"type": "string"
}
},
"type": "object"
},
"InfoQuestion": {
"properties": {
"description_en": {
"type": "string"
},
"description_fi": {
"type": "string"
},
"id": {
"type": "string"
},
"required": {
"enum": [
false
],
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"info"
],
"type": "string"
}
},
"type": "object"
},
"IntegerQuestion": {
"properties": {
"id": {
"type": "string"
},
"options": {
"properties": {
"enum": {
"anyOf": [
{
"items": [
{
"items": {
"type": "string"
},
"type": "array"
}
],
"maxItems": 1,
"minItems": 1,
"type": "array"
},
{
"items": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"items": {
"type": "string"
},
"type": "array"
}
],
"maxItems": 2,
"minItems": 2,
"type": "array"
}
]
}
},
"type": "object"
},
"required": {
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"integer"
],
"type": "string"
}
},
"type": "object"
},
"NameQuestion": {
"properties": {
"id": {
"type": "string"
},
"required": {
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"name"
],
"type": "string"
}
},
"type": "object"
},
"RadioQuestion": {
"properties": {
"id": {
"type": "string"
},
"options": {
"properties": {
"enum": {
"items": {
"type": "string"
},
"type": "array"
},
"enumNames_en": {
"items": {
"type": "string"
},
"type": "array"
},
"enumNames_fi": {
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"required": {
"enum": [
true
],
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"radiobutton"
],
"type": "string"
}
},
"type": "object"
},
"TextQuestion": {
"properties": {
"id": {
"type": "string"
},
"required": {
"type": "boolean"
},
"title_en": {
"type": "string"
},
"title_fi": {
"type": "string"
},
"type": {
"enum": [
"text"
],
"type": "string"
}
},
"type": "object"
}
},
"items": {
"anyOf": [
{
"$ref": "#/definitions/TextQuestion"
},
{
"$ref": "#/definitions/InfoQuestion"
},
{
"$ref": "#/definitions/IntegerQuestion"
},
{
"$ref": "#/definitions/RadioQuestion"
},
{
"$ref": "#/definitions/CheckboxQuestion"
},
{
"$ref": "#/definitions/EmailQuestion"
},
{
"$ref": "#/definitions/NameQuestion"
}
]
},
"type": "array"
}