Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Autodocodec.Schema
Synopsis
- jsonSchemaViaCodec :: forall a. HasCodec a => JSONSchema
- jsonSchemaVia :: ValueCodec input output -> JSONSchema
- jsonObjectSchemaViaCodec :: forall a. HasObjectCodec a => ObjectSchema
- jsonObjectSchemaVia :: ObjectCodec input output -> ObjectSchema
- data JSONSchema
- = AnySchema
- | NullSchema
- | BoolSchema
- | StringSchema
- | IntegerSchema !(Bounds Integer)
- | NumberSchema !(Bounds Scientific)
- | ArraySchema !JSONSchema
- | MapSchema !JSONSchema
- | ObjectSchema !ObjectSchema
- | ValueSchema !Value
- | AnyOfSchema !(NonEmpty JSONSchema)
- | OneOfSchema !(NonEmpty JSONSchema)
- | CommentSchema !Text !JSONSchema
- | RefSchema !Text
- | WithDefSchema !(Map Text JSONSchema) !JSONSchema
- data ObjectSchema
- data KeyRequirement
- validateAccordingTo :: Value -> JSONSchema -> Bool
- validateObjectAccordingTo :: Value -> JSONSchema -> Bool
Documentation
jsonSchemaViaCodec :: forall a. HasCodec a => JSONSchema Source #
jsonSchemaVia :: ValueCodec input output -> JSONSchema Source #
jsonObjectSchemaViaCodec :: forall a. HasObjectCodec a => ObjectSchema Source #
jsonObjectSchemaVia :: ObjectCodec input output -> ObjectSchema Source #
data JSONSchema Source #
A JSON Schema
http://json-schema.org/understanding-json-schema/reference/index.html
Contrary to a Codec
, values of this type should be finite.
NOTE: This schema roundtrips to JSON, but it cannot expres everything that a fully-featured json-schema may be able to express.
Constructors
AnySchema | |
NullSchema | |
BoolSchema | |
StringSchema | |
IntegerSchema !(Bounds Integer) | |
NumberSchema !(Bounds Scientific) | |
ArraySchema !JSONSchema | |
MapSchema !JSONSchema | |
ObjectSchema !ObjectSchema | This needs to be a list because keys should stay in their original ordering. |
ValueSchema !Value | |
AnyOfSchema !(NonEmpty JSONSchema) | |
OneOfSchema !(NonEmpty JSONSchema) | |
CommentSchema !Text !JSONSchema | |
RefSchema !Text | |
WithDefSchema !(Map Text JSONSchema) !JSONSchema |
Instances
data ObjectSchema Source #
Constructors
Instances
data KeyRequirement Source #
Instances
validateAccordingTo :: Value -> JSONSchema -> Bool Source #
validateObjectAccordingTo :: Value -> JSONSchema -> Bool Source #