gemseo / third_party / fastjsonschema

draft06 module

class gemseo.third_party.fastjsonschema.draft06.CodeGeneratorDraft06(definition, resolver=None)[source]

Bases: gemseo.third_party.fastjsonschema.draft04.CodeGeneratorDraft04

FORMAT_REGEXS = {'date-time': '^\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:[+-][0-2]\\d:[0-5]\\d|Z)?\\Z', 'email': '^[^@]+@[^@]+\\.[^@]+\\Z', 'hostname': '^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]{0,61}[A-Za-z0-9])\\Z', 'ipv4': '^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\Z', 'ipv6': '^(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|::(?:[0-9A-Fa-f]{1,4}:){5}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))|(?:[0-9A-Fa-f]{1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\\\s]*(#[^\\\\\\s]*)?\\Z', 'uri-template': '^(?:(?:[^\\x00-\\x20\\"\\\'<>%\\\\^`{|}]|%[0-9a-f]{2})|\\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\\*)?)*\\})*\\Z'}
generate_boolean_schema()[source]

Means that schema can be specified by boolean. True means everything is valid, False everything is invalid.

generate_const()[source]

Means that value is valid when is equeal to const definition.

{
    'const': 42,
}

Only valid value is 42 in this example.

generate_contains()[source]

Means that array must contain at least one defined item.

{
    'contains': {
        'type': 'number',
    },
}

Valid array is any with at least one number.

generate_exclusive_maximum()[source]
generate_exclusive_minimum()[source]
generate_property_names()[source]

Means that keys of object must to follow this definition.

{
    'propertyNames': {
        'maxLength': 3,
    },
}

Valid keys of object for this definition are foo, bar, … but not foobar for example.

generate_type()[source]

Validation of type. Can be one type or list of types.

Since draft 06 a float without fractional part is an integer.

{'type': 'string'}
{'type': ['string', 'number']}