{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Data.Swagger.Lens where
import Control.Lens
import Data.Aeson (Value)
import Data.Scientific (Scientific)
import Data.Swagger.Internal
import Data.Swagger.Internal.Utils
import Data.Text (Text)
makeFields ''Swagger
makeFields ''Host
makeFields ''Info
makeFields ''Contact
makeFields ''License
makeLensesWith swaggerFieldRules ''PathItem
makeFields ''Tag
makeFields ''Operation
makeFields ''Param
makeLensesWith swaggerFieldRules ''ParamOtherSchema
makeFields ''Header
makeFields ''Schema
makeFields ''NamedSchema
makeLensesWith swaggerFieldRules ''ParamSchema
makeFields ''Xml
makeLensesWith swaggerFieldRules ''Responses
makeLensesWith swaggerFieldRules ''SecurityScheme
makeFields ''ApiKeyParams
makeFields ''OAuth2Params
makeFields ''ExternalDocs
makePrisms ''ParamAnySchema
makePrisms ''SecuritySchemeType
makePrisms ''Referenced
_SwaggerItemsArray :: Review (SwaggerItems 'SwaggerKindSchema) [Referenced Schema]
_SwaggerItemsArray :: Review (SwaggerItems 'SwaggerKindSchema) [Referenced Schema]
_SwaggerItemsArray
= forall (p :: * -> * -> *) (f :: * -> *) b t s a.
(Profunctor p, Bifunctor p, Functor f) =>
(b -> t) -> Optic p f s t a b
unto (\[Referenced Schema]
x -> [Referenced Schema] -> SwaggerItems 'SwaggerKindSchema
SwaggerItemsArray [Referenced Schema]
x)
_SwaggerItemsObject :: Review (SwaggerItems 'SwaggerKindSchema) (Referenced Schema)
_SwaggerItemsObject :: Review (SwaggerItems 'SwaggerKindSchema) (Referenced Schema)
_SwaggerItemsObject
= forall (p :: * -> * -> *) (f :: * -> *) b t s a.
(Profunctor p, Bifunctor p, Functor f) =>
(b -> t) -> Optic p f s t a b
unto (\Referenced Schema
x -> Referenced Schema -> SwaggerItems 'SwaggerKindSchema
SwaggerItemsObject Referenced Schema
x)
_SwaggerItemsPrimitive :: forall t p f. (Profunctor p, Bifunctor p, Functor f) => Optic' p f (SwaggerItems t) (Maybe (CollectionFormat t), ParamSchema t)
_SwaggerItemsPrimitive :: forall (t :: SwaggerKind (*)) (p :: * -> * -> *) (f :: * -> *).
(Profunctor p, Bifunctor p, Functor f) =>
Optic'
p f (SwaggerItems t) (Maybe (CollectionFormat t), ParamSchema t)
_SwaggerItemsPrimitive = forall (p :: * -> * -> *) (f :: * -> *) b t s a.
(Profunctor p, Bifunctor p, Functor f) =>
(b -> t) -> Optic p f s t a b
unto (\(Maybe (CollectionFormat t)
c, ParamSchema t
p) -> forall (t :: SwaggerKind (*)).
Maybe (CollectionFormat t) -> ParamSchema t -> SwaggerItems t
SwaggerItemsPrimitive Maybe (CollectionFormat t)
c ParamSchema t
p)
type instance Index Responses = HttpStatusCode
type instance Index Operation = HttpStatusCode
type instance IxValue Responses = Referenced Response
type instance IxValue Operation = Referenced Response
instance Ixed Responses where ix :: Index Responses -> Traversal' Responses (IxValue Responses)
ix Index Responses
n = forall s a. HasResponses s a => Lens' s a
responses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index Responses
n
instance At Responses where at :: Index Responses -> Lens' Responses (Maybe (IxValue Responses))
at Index Responses
n = forall s a. HasResponses s a => Lens' s a
responses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index Responses
n
instance Ixed Operation where ix :: Index Operation -> Traversal' Operation (IxValue Operation)
ix Index Operation
n = forall s a. HasResponses s a => Lens' s a
responses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index Operation
n
instance At Operation where at :: Index Operation -> Lens' Operation (Maybe (IxValue Operation))
at Index Operation
n = forall s a. HasResponses s a => Lens' s a
responses forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index Operation
n
type instance Index SecurityDefinitions = Text
type instance IxValue SecurityDefinitions = SecurityScheme
instance Ixed SecurityDefinitions where ix :: Index SecurityDefinitions
-> Traversal' SecurityDefinitions (IxValue SecurityDefinitions)
ix Index SecurityDefinitions
n = (forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced :: Lens' SecurityDefinitions (Definitions SecurityScheme))forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index SecurityDefinitions
n
instance At SecurityDefinitions where at :: Index SecurityDefinitions
-> Lens' SecurityDefinitions (Maybe (IxValue SecurityDefinitions))
at Index SecurityDefinitions
n = (forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
coerced :: Lens' SecurityDefinitions (Definitions SecurityScheme))forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. At m => Index m -> Lens' m (Maybe (IxValue m))
at Index SecurityDefinitions
n
instance HasParamSchema NamedSchema (ParamSchema 'SwaggerKindSchema) where paramSchema :: Lens' NamedSchema (ParamSchema 'SwaggerKindSchema)
paramSchema = forall s a. HasSchema s a => Lens' s a
schemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasParamSchema s a => Lens' s a
paramSchema
instance HasType Header (Maybe (SwaggerType ('SwaggerKindNormal Header))) where type_ :: Lens' Header (Maybe (SwaggerType ('SwaggerKindNormal Header)))
type_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasType s a => Lens' s a
type_
instance HasType Schema (Maybe (SwaggerType 'SwaggerKindSchema)) where type_ :: Lens' Schema (Maybe (SwaggerType 'SwaggerKindSchema))
type_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasType s a => Lens' s a
type_
instance HasType NamedSchema (Maybe (SwaggerType 'SwaggerKindSchema)) where type_ :: Lens' NamedSchema (Maybe (SwaggerType 'SwaggerKindSchema))
type_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasType s a => Lens' s a
type_
instance HasType ParamOtherSchema (Maybe (SwaggerType 'SwaggerKindParamOtherSchema)) where type_ :: Lens'
ParamOtherSchema (Maybe (SwaggerType 'SwaggerKindParamOtherSchema))
type_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasType s a => Lens' s a
type_
instance HasDefault Header (Maybe Value) where default_ :: Lens' Header (Maybe Value)
default_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasDefault s a => Lens' s a
default_
instance HasDefault Schema (Maybe Value) where default_ :: Lens' Schema (Maybe Value)
default_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasDefault s a => Lens' s a
default_
instance HasDefault ParamOtherSchema (Maybe Value) where default_ :: Lens' ParamOtherSchema (Maybe Value)
default_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasDefault s a => Lens' s a
default_
instance
{-# OVERLAPPABLE #-}
HasParamSchema s (ParamSchema t)
=> HasFormat s (Maybe Format) where
format :: Lens' s (Maybe Text)
format = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasFormat s a => Lens' s a
format
instance
{-# OVERLAPPABLE #-}
HasParamSchema s (ParamSchema t)
=> HasItems s (Maybe (SwaggerItems t)) where
items :: Lens' s (Maybe (SwaggerItems t))
items = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasItems s a => Lens' s a
items
instance
{-# OVERLAPPABLE #-}
HasParamSchema s (ParamSchema t)
=> HasMaximum s (Maybe Scientific) where
maximum_ :: Lens' s (Maybe Scientific)
maximum_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMaximum s a => Lens' s a
maximum_
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasExclusiveMaximum s (Maybe Bool) where
exclusiveMaximum :: Lens' s (Maybe Bool)
exclusiveMaximum = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasExclusiveMaximum s a => Lens' s a
exclusiveMaximum
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMinimum s (Maybe Scientific) where
minimum_ :: Lens' s (Maybe Scientific)
minimum_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMinimum s a => Lens' s a
minimum_
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasExclusiveMinimum s (Maybe Bool) where
exclusiveMinimum :: Lens' s (Maybe Bool)
exclusiveMinimum = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasExclusiveMinimum s a => Lens' s a
exclusiveMinimum
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMaxLength s (Maybe Integer) where
maxLength :: Lens' s (Maybe Integer)
maxLength = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMaxLength s a => Lens' s a
maxLength
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMinLength s (Maybe Integer) where
minLength :: Lens' s (Maybe Integer)
minLength = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMinLength s a => Lens' s a
minLength
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasPattern s (Maybe Text) where
pattern :: Lens' s (Maybe Text)
pattern = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasPattern s a => Lens' s a
pattern
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMaxItems s (Maybe Integer) where
maxItems :: Lens' s (Maybe Integer)
maxItems = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMaxItems s a => Lens' s a
maxItems
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMinItems s (Maybe Integer) where
minItems :: Lens' s (Maybe Integer)
minItems = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMinItems s a => Lens' s a
minItems
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasUniqueItems s (Maybe Bool) where
uniqueItems :: Lens' s (Maybe Bool)
uniqueItems = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasUniqueItems s a => Lens' s a
uniqueItems
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasEnum s (Maybe [Value]) where
enum_ :: Lens' s (Maybe [Value])
enum_ = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasEnum s a => Lens' s a
enum_
instance {-# OVERLAPPABLE #-} HasParamSchema s (ParamSchema t)
=> HasMultipleOf s (Maybe Scientific) where
multipleOf :: Lens' s (Maybe Scientific)
multipleOf = forall s a. HasParamSchema s a => Lens' s a
paramSchemaforall b c a. (b -> c) -> (a -> b) -> a -> c
.forall s a. HasMultipleOf s a => Lens' s a
multipleOf