pyschema_extensions/jsonschema.py
def get_schema_dict(record, state=None):
    """Return a python dict representing the jsonschema of a record

    Any references to sub-schemas will be URI fragments that won't be
    resolvable without a root schema, available from get_root_schema_dict.
    """
    state = state or SchemaGeneratorState()
    schema = OrderedDict([
        ('type', 'object'),
        ('id', record._schema_name),
    ])
    fields = dict()
    for field_name, field_type in record._fields.iteritems():
        fields[field_name] = field_type.jsonschema_type_schema(state)

    required = set(fields.keys())
    schema['properties'] = fields
    schema['required'] = sorted(list(required))
    schema['additionalProperties'] = False

    state.record_schemas[record._schema_name] = schema
    return schema
def get_schema_dict(record, state=None):
    state = state or SchemaGeneratorState()
    schema = OrderedDict([
        ('type', 'object'),
        ('id', record._schema_name),
    ])
    fields = dict()
    for field_name, field_type in record._fields.iteritems():
        fields[field_name] = field_type.jsonschema_type_schema(state)

    required = set(fields.keys())
    schema['properties'] = fields
    schema['required'] = sorted(list(required))
    schema['additionalProperties'] = False

    state.record_schemas[record._schema_name] = schema
    return schema
def get_schema_dict ( record , state = None ) : state = state or SchemaGeneratorState ( ) schema = OrderedDict ( [ ( 'type' , 'object' ) , ( 'id' , record . _schema_name ) , ] ) fields = dict ( ) for field_name , field_type in record . _fields . iteritems ( ) : fields [ field_name ] = field_type . jsonschema_type_schema ( state ) required = set ( fields . keys ( ) ) schema [ 'properties' ] = fields schema [ 'required' ] = sorted ( list ( required ) ) schema [ 'additionalProperties' ] = False state . record_schemas [ record . _schema_name ] = schema return schema
Return a python dict representing the jsonschema of a record

    Any references to sub-schemas will be URI fragments that won't be
    resolvable without a root schema, available from get_root_schema_dict.
Return a python dict representing the jsonschema of a record