Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bublik/data/schemas/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
"description": "List of patterns for assigning metas to the category",
"items": {
"type": "string",
"minLength": 1
"minLength": 1,
"format": "regex"
},
"uniqueItems": true
}
Expand Down
11 changes: 8 additions & 3 deletions bublik/data/schemas/references.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
"uri": {
"type": "array",
"items": {
"type": "string"
"type": "string",
"pattern": "^https?://"
},
"minItems": 1,
"uniqueItems": true
}
},
Expand All @@ -26,6 +28,7 @@
],
"additionalProperties": false
},
"minItems": 1,
"uniqueItems": true,
"default": [
{
Expand All @@ -46,7 +49,8 @@
"type": "string"
},
"uri": {
"type": "string"
"type": "string",
"pattern": "^https?://"
}
},
"required": [
Expand All @@ -66,7 +70,8 @@
"type": "string"
},
"uri": {
"type": "string"
"type": "string",
"pattern": "^https?://"
}
},
"required": [
Expand Down
4 changes: 2 additions & 2 deletions bublik/data/serializers/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.contrib.auth import get_user_model
from django.db import transaction
import jsonschema
from jsonschema import validate
from jsonschema import FormatChecker, validate
from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

Expand Down Expand Up @@ -117,7 +117,7 @@ def ensure_json(config_content):
json_schema = ConfigServices.get_schema(config_type, config_name)
if json_schema:
try:
validate(instance=content, schema=json_schema)
validate(instance=content, schema=json_schema, format_checker=FormatChecker())
except jsonschema.exceptions.ValidationError as jeve:
jeve_msg = jeve.message[0].lower() + jeve.message[1:]
msg = f'Invalid format: {jeve_msg}'
Expand Down
Loading