1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FunctionalDependencies #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE TemplateHaskell #-}
5module Data.Swagger.Lens where
9import Data.Aeson (Value)
10import Data.Swagger.Internal
11import Data.Text (Text)
13-- =======================================================================
15-- =======================================================================
27makePrisms ''ParameterSchema
28makeLenses ''ParameterOtherSchema
32makePrisms ''SchemaItems
33makeLenses ''SchemaCommon
37makeLenses ''SecurityScheme
38makePrisms ''SecuritySchemeType
39makeLenses ''ApiKeyParams
40makeLenses ''OAuth2Params
41makeLenses ''ExternalDocs
43-- =======================================================================
44-- Helper classy lenses
45-- =======================================================================
47class HasDescription s d | s -> d where
48 description :: Lens' s d
50instance HasDescription Response Text where description = responseDescription
51instance HasDescription Info (Maybe Text) where description = infoDescription
52instance HasDescription Tag (Maybe Text) where description = tagDescription
53instance HasDescription Operation (Maybe Text) where description = operationDescription
54instance HasDescription Parameter (Maybe Text) where description = parameterDescription
55instance HasDescription Header (Maybe Text) where description = headerDescription
56instance HasDescription Schema (Maybe Text) where description = schemaDescription
57instance HasDescription SecurityScheme (Maybe Text) where description = securitySchemeDescription
58instance HasDescription ExternalDocs (Maybe Text) where description = externalDocsDescription
60class HasSchemaCommon s where
61 schemaCommon :: Lens' s SchemaCommon
63instance HasSchemaCommon Schema where schemaCommon = schemaSchemaCommon
64instance HasSchemaCommon ParameterOtherSchema where schemaCommon = parameterOtherSchemaCommon
65instance HasSchemaCommon Items where schemaCommon = itemsCommon
66instance HasSchemaCommon Header where schemaCommon = headerCommon
67instance HasSchemaCommon SchemaCommon where schemaCommon = id
69schemaDefault :: HasSchemaCommon s => Lens' s (Maybe Value)
70schemaDefault = schemaCommon.schemaCommonDefault
72schemaMaximum :: HasSchemaCommon s => Lens' s (Maybe Integer)
73schemaMaximum = schemaCommon.schemaCommonMaximum
75schemaExclusiveMaximum :: HasSchemaCommon s => Lens' s (Maybe Bool)
76schemaExclusiveMaximum = schemaCommon.schemaCommonExclusiveMaximum
78schemaMinimum :: HasSchemaCommon s => Lens' s (Maybe Integer)
79schemaMinimum = schemaCommon.schemaCommonMinimum
81schemaExclusiveMinimum :: HasSchemaCommon s => Lens' s (Maybe Bool)
82schemaExclusiveMinimum = schemaCommon.schemaCommonExclusiveMinimum
84schemaMaxLength :: HasSchemaCommon s => Lens' s (Maybe Integer)
85schemaMaxLength = schemaCommon.schemaCommonMaxLength
87schemaMinLength :: HasSchemaCommon s => Lens' s (Maybe Integer)
88schemaMinLength = schemaCommon.schemaCommonMinLength
90schemaPattern :: HasSchemaCommon s => Lens' s (Maybe Text)
91schemaPattern = schemaCommon.schemaCommonPattern
93schemaMaxItems :: HasSchemaCommon s => Lens' s (Maybe Integer)
94schemaMaxItems = schemaCommon.schemaCommonMaxItems
96schemaMinItems :: HasSchemaCommon s => Lens' s (Maybe Integer)
97schemaMinItems = schemaCommon.schemaCommonMinItems
99schemaUniqueItems :: HasSchemaCommon s => Lens' s (Maybe Bool)
100schemaUniqueItems = schemaCommon.schemaCommonUniqueItems
102schemaEnum :: HasSchemaCommon s => Lens' s (Maybe [Value])
103schemaEnum = schemaCommon.schemaCommonEnum
105schemaMultipleOf :: HasSchemaCommon s => Lens' s (Maybe Integer)
106schemaMultipleOf = schemaCommon.schemaCommonMultipleOf
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list