Exemplo n.º 1
0
    "is_property_type_oneof",
    "is_property_nullable",
    "is_attribute_type_array",
    "is_attribute_type_object",
    "validate",
]

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    "draft4":
    jsonify.load_file(os.path.join(PATH, "draft4.json")),
    "custom":
    jsonify.load_file(os.path.join(PATH, "custom.json")),
    # Custom schema for action params which doesn't allow parameter "type" attribute to be array
    "action_params":
    jsonify.load_file(os.path.join(PATH, "action_params.json")),
    "action_output_schema":
    jsonify.load_file(os.path.join(PATH, "action_output_schema.json")),
}

SCHEMA_ANY_TYPE = {
    "anyOf": [
        {
            "type": "array"
        },
        {
Exemplo n.º 2
0
__all__ = [
    'get_validator', 'get_draft_schema', 'get_action_parameters_schema',
    'get_schema_for_action_parameters', 'get_schema_for_resource_parameters',
    'is_property_type_single', 'is_property_type_list',
    'is_property_type_anyof', 'is_property_type_oneof', 'is_property_nullable',
    'is_attribute_type_array', 'is_attribute_type_object', 'validate'
]

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    'draft4': jsonify.load_file(os.path.join(PATH, 'draft4.json')),
    'custom': jsonify.load_file(os.path.join(PATH, 'custom.json')),

    # Custom schema for action params which doesn't allow parameter "type" attribute to be array
    'action_params': jsonify.load_file(os.path.join(PATH,
                                                    'action_params.json'))
}

SCHEMA_ANY_TYPE = {
    "anyOf": [{
        "type": "array"
    }, {
        "type": "boolean"
    }, {
        "type": "integer"
    }, {
Exemplo n.º 3
0
__all__ = [
    'get_validator',
    'get_draft_schema',
    'get_action_parameters_schema',
    'get_schema_for_action_parameters',
    'validate'
]

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    'draft4': jsonify.load_file(os.path.join(PATH, 'draft4.json')),
    'custom': jsonify.load_file(os.path.join(PATH, 'custom.json')),

    # Custom schema for action params which doesn't allow parameter "type" attribute to be array
    'action_params': jsonify.load_file(os.path.join(PATH, 'action_params.json'))
}

SCHEMA_ANY_TYPE = {
    "anyOf": [
        {"type": "array"},
        {"type": "boolean"},
        {"type": "integer"},
        {"type": "number"},
        {"type": "object"},
        {"type": "string"}
    ]
Exemplo n.º 4
0
import jsonschema
from jsonschema import _validators
from jsonschema.validators import create

from st2common.util import jsonify

__all__ = ['get_validator', 'get_parameter_schema', 'validate']

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    'draft4': jsonify.load_file('%s/draft4.json' % PATH),
    'custom': jsonify.load_file('%s/custom.json' % PATH)
}

SCHEMA_ANY_TYPE = {
    "anyOf": [{
        "type": "array"
    }, {
        "type": "boolean"
    }, {
        "type": "integer"
    }, {
        "type": "number"
    }, {
        "type": "object"
    }, {
Exemplo n.º 5
0
from st2common.util import jsonify

__all__ = [
    'get_validator',
    'get_parameter_schema',
    'validate'
]

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    'draft4': jsonify.load_file('%s/draft4.json' % PATH),
    'custom': jsonify.load_file('%s/custom.json' % PATH)
}

SCHEMA_ANY_TYPE = {
    "anyOf": [
        {"type": "array"},
        {"type": "boolean"},
        {"type": "integer"},
        {"type": "number"},
        {"type": "object"},
        {"type": "string"}
    ]
}

Exemplo n.º 6
0
    'get_validator', 'get_draft_schema', 'get_action_parameters_schema',
    'get_schema_for_action_parameters', 'get_schema_for_resource_parameters',
    'is_property_type_single', 'is_property_type_list',
    'is_property_type_anyof', 'is_property_type_oneof', 'is_property_nullable',
    'is_attribute_type_array', 'is_attribute_type_object', 'validate'
]

# https://github.com/json-schema/json-schema/blob/master/draft-04/schema
# The source material is licensed under the AFL or BSD license.
# Both draft 4 and custom schema has additionalProperties set to false by default.
# The custom schema differs from draft 4 with the extension of position, immutable,
# and draft 3 version of required.
PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)))
SCHEMAS = {
    'draft4':
    jsonify.load_file(os.path.join(PATH, 'draft4.json')),
    'custom':
    jsonify.load_file(os.path.join(PATH, 'custom.json')),

    # Custom schema for action params which doesn't allow parameter "type" attribute to be array
    'action_params':
    jsonify.load_file(os.path.join(PATH, 'action_params.json')),
    'action_output_schema':
    jsonify.load_file(os.path.join(PATH, 'action_output_schema.json'))
}

SCHEMA_ANY_TYPE = {
    "anyOf": [{
        "type": "array"
    }, {
        "type": "boolean"