Maintainer | Brandon Chinn <brandon@leapyear.io> |
---|---|
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Data.Aeson.Schema.Key
Description
Defines a SchemaKey.
Synopsis
- data SchemaKey' s
- = NormalKey s
- | PhantomKey s
- type SchemaKeyV = SchemaKey' String
- fromSchemaKeyV :: SchemaKeyV -> String
- showSchemaKeyV :: SchemaKeyV -> String
- getContext :: SchemaKeyV -> Object -> Value
- toContext :: SchemaKeyV -> Value -> Object
- type SchemaKey = SchemaKey' Symbol
- class KnownSymbol (FromSchemaKey key) => IsSchemaKey (key :: SchemaKey) where
- type FromSchemaKey key :: Symbol
- toSchemaKeyV :: Proxy key -> SchemaKeyV
- fromSchemaKey :: forall key. IsSchemaKey key => String
- showSchemaKey :: forall key. IsSchemaKey key => String
Documentation
data SchemaKey' s Source #
A key in a JSON object schema.
Constructors
NormalKey s | |
PhantomKey s | A key that doesn't actually exist in the object, but whose content should be parsed from the current object. |
Instances
type SchemaKeyV = SchemaKey' String Source #
A value-level SchemaKey
fromSchemaKeyV :: SchemaKeyV -> String Source #
showSchemaKeyV :: SchemaKeyV -> String Source #
getContext :: SchemaKeyV -> Object -> Value Source #
Given schema `{ key: innerSchema }` for JSON data `{ key: val1 }`, get the JSON
Value that innerSchema
should parse.
toContext :: SchemaKeyV -> Value -> Object Source #
Given JSON data val
adhering to innerSchema
, get the JSON object that should be
merged with the outer JSON object.
type SchemaKey = SchemaKey' Symbol Source #
A type-level SchemaKey
class KnownSymbol (FromSchemaKey key) => IsSchemaKey (key :: SchemaKey) where Source #
Associated Types
type FromSchemaKey key :: Symbol Source #
Methods
toSchemaKeyV :: Proxy key -> SchemaKeyV Source #
Instances
KnownSymbol key => IsSchemaKey ('NormalKey key) Source # | |
Defined in Data.Aeson.Schema.Key Associated Types type FromSchemaKey ('NormalKey key) :: Symbol Source # Methods toSchemaKeyV :: Proxy ('NormalKey key) -> SchemaKeyV Source # | |
KnownSymbol key => IsSchemaKey ('PhantomKey key) Source # | |
Defined in Data.Aeson.Schema.Key Associated Types type FromSchemaKey ('PhantomKey key) :: Symbol Source # Methods toSchemaKeyV :: Proxy ('PhantomKey key) -> SchemaKeyV Source # |
fromSchemaKey :: forall key. IsSchemaKey key => String Source #
showSchemaKey :: forall key. IsSchemaKey key => String Source #