git.iko.soy/typeable/openapi3
on master help sign in
Merge pull request #4 from paweln1986/rename-swagger-to-openApi

Rename swagger to open api

commitbd9df532f2381c4b22fe86ef722715088f5cfa68 authorMaxim Koltsov <kolmax94@gmail.com> dateTue 4 Aug 2020, 14:29 (6 years ago) parenta30c32498e9537
14 files changed+259−259
examples/hackage.hs+7−7 src/Data/OpenApi.hs+11−11 src/Data/OpenApi/Internal.hs+47−47 src/Data/OpenApi/Internal/ParamSchema.hs+22−22 src/Data/OpenApi/Internal/Schema.hs+44−44 src/Data/OpenApi/Internal/Schema/Validation.hs+33−33 src/Data/OpenApi/Lens.hs+16−16 src/Data/OpenApi/Operation.hs+13−13 src/Data/OpenApi/Optics.hs+17−17 src/Data/OpenApi/Schema/Generator.hs+9−9 src/Data/OpenApi/Schema/Validation.hs+3−3 test/Data/OpenApi/Schema/GeneratorSpec.hs+4−4 test/Data/OpenApi/Schema/ValidationSpec.hs+1−1 test/Data/OpenApiSpec.hs+32−32
examples/hackage.hs+7−7
@@ -27,7 +27,7 @@ instance ToSchema UserSummary where
2727 usernameSchema <- declareSchemaRef (Proxy :: Proxy Username)
2828 useridSchema <- declareSchemaRef (Proxy :: Proxy Int)
2929 return $ NamedSchema (Just "UserSummary") $ mempty
30− & type_ ?~ SwaggerObject
30+ & type_ ?~ OpenApiObject
3131 & properties .~
3232 [ ("summaryUsername", usernameSchema )
3333 , ("summaryUserid" , useridSchema )
@@ -47,13 +47,13 @@ data UserDetailed = UserDetailed
4747newtype Package = Package { packageName :: Text }
4848 deriving (Generic, ToSchema)
4949
50−hackageSwagger :: Swagger
51−hackageSwagger = spec & components.schemas .~ defs
50+hackageOpenApi :: OpenApi
51+hackageOpenApi = spec & components.schemas .~ defs
5252 where
53− (defs, spec) = runDeclare declareHackageSwagger mempty
53+ (defs, spec) = runDeclare declareHackageOpenApi mempty
5454
55−declareHackageSwagger :: Declare (Definitions Schema) Swagger
56−declareHackageSwagger = do
55+declareHackageOpenApi :: Declare (Definitions Schema) OpenApi
56+declareHackageOpenApi = do
5757 -- param schemas
5858 let usernameParamSchema = toParamSchema (Proxy :: Proxy Username)
5959
@@ -78,5 +78,5 @@ declareHackageSwagger = do
7878 ]
7979
8080main :: IO ()
81−main = putStrLn . read . show . encode $ hackageSwagger
81+main = putStrLn . read . show . encode $ hackageOpenApi
8282
src/Data/OpenApi.hs+11−11
@@ -37,7 +37,7 @@ module Data.OpenApi (
3737 module Data.OpenApi.Schema.Validation,
3838
3939 -- * Swagger specification
40− Swagger(..),
40+ OpenApi(..),
4141 Server(..),
4242 ServerVariable(..),
4343 Components(..),
@@ -56,7 +56,7 @@ module Data.OpenApi (
5656 TagName,
5757
5858 -- ** Types and formats
59− SwaggerType(..),
59+ OpenApiType(..),
6060 Format,
6161 Definitions,
6262 Style(..),
@@ -75,7 +75,7 @@ module Data.OpenApi (
7575 -- ** Schemas
7676 Schema(..),
7777 NamedSchema(..),
78− SwaggerItems(..),
78+ OpenApiItems(..),
7979 Xml(..),
8080 Pattern,
8181 AdditionalProperties(..),
@@ -152,7 +152,7 @@ import Data.OpenApi.Internal
152152--
153153-- In this library you can use @'mempty'@ for a default/empty value. For instance:
154154--
155−-- >>> BSL.putStrLn $ encode (mempty :: Swagger)
155+-- >>> BSL.putStrLn $ encode (mempty :: OpenApi)
156156-- {"openapi":"3.0.0","info":{"version":"","title":""},"components":{}}
157157--
158158-- As you can see some spec properties (e.g. @"version"@) are there even when the spec is empty.
@@ -173,14 +173,14 @@ import Data.OpenApi.Internal
173173--
174174-- @
175175-- \-\- /account subAPI specification
176−-- accountAPI :: Swagger
176+-- accountAPI :: OpenApi
177177--
178178-- \-\- /task subAPI specification
179−-- taskAPI :: Swagger
179+-- taskAPI :: OpenApi
180180--
181181-- \-\- while API specification is just a combination
182182-- \-\- of subAPIs' specifications
183−-- api :: Swagger
183+-- api :: OpenApi
184184-- api = accountAPI <> taskAPI
185185-- @
186186
@@ -193,8 +193,8 @@ import Data.OpenApi.Internal
193193-- make it fairly simple to construct/modify any part of the specification:
194194--
195195-- >>> :{
196−-- BSL.putStrLn $ encode $ (mempty :: Swagger)
197−-- & components . schemas .~ [ ("User", mempty & type_ ?~ SwaggerString) ]
196+-- BSL.putStrLn $ encode $ (mempty :: OpenApi)
197+-- & components . schemas .~ [ ("User", mempty & type_ ?~ OpenApiString) ]
198198-- & paths .~
199199-- [ ("/user", mempty & get ?~ (mempty
200200-- & at 200 ?~ ("OK" & _Inline.content.at "application/json" ?~ (mempty & schema ?~ Ref (Reference "User")))
@@ -216,7 +216,7 @@ import Data.OpenApi.Internal
216216-- {"description":"No content"}
217217-- >>> :{
218218-- BSL.putStrLn $ encode $ (mempty :: Schema)
219−-- & type_ ?~ SwaggerBoolean
219+-- & type_ ?~ OpenApiBoolean
220220-- & description ?~ "To be or not to be"
221221-- :}
222222-- {"type":"boolean","description":"To be or not to be"}
@@ -244,7 +244,7 @@ import Data.OpenApi.Internal
244244-- @'ParamSchema'@ and @'Schema'@ are the two core types for data model specification.
245245--
246246-- @'ParamSchema' t@ specifies all the common properties, available for every data schema.
247−-- The @t@ parameter imposes some restrictions on @type@ and @items@ properties (see @'SwaggerType'@ and @'SwaggerItems'@).
247+-- The @t@ parameter imposes some restrictions on @type@ and @items@ properties (see @'OpenApiType'@ and @'OpenApiItems'@).
248248--
249249-- @'Schema'@ is used for request and response bodies and allows specifying objects
250250-- with properties in addition to what @'ParamSchema'@ provides.
src/Data/OpenApi/Internal.hs+47−47
@@ -65,38 +65,38 @@ import Data.OpenApi.Internal.AesonUtils (sopSwaggerGenericToEncoding)
6565type Definitions = InsOrdHashMap Text
6666
6767-- | This is the root document object for the API specification.
68−data Swagger = Swagger
68+data OpenApi = OpenApi
6969 { -- | Provides metadata about the API.
7070 -- The metadata can be used by the clients if needed.
71− _swaggerInfo :: Info
71+ _openApiInfo :: Info
7272
7373 -- | An array of Server Objects, which provide connectivity information
7474 -- to a target server. If the servers property is not provided, or is an empty array,
7575 -- the default value would be a 'Server' object with a url value of @/@.
76− , _swaggerServers :: [Server]
76+ , _openApiServers :: [Server]
7777
7878 -- | The available paths and operations for the API.
79− , _swaggerPaths :: InsOrdHashMap FilePath PathItem
79+ , _openApiPaths :: InsOrdHashMap FilePath PathItem
8080
8181 -- | An element to hold various schemas for the specification.
82− , _swaggerComponents :: Components
82+ , _openApiComponents :: Components
8383
8484 -- | A declaration of which security mechanisms can be used across the API.
8585 -- The list of values includes alternative security requirement objects that can be used.
8686 -- Only one of the security requirement objects need to be satisfied to authorize a request.
8787 -- Individual operations can override this definition.
8888 -- To make security optional, an empty security requirement can be included in the array.
89− , _swaggerSecurity :: [SecurityRequirement]
89+ , _openApiSecurity :: [SecurityRequirement]
9090
9191 -- | A list of tags used by the specification with additional metadata.
9292 -- The order of the tags can be used to reflect on their order by the parsing tools.
9393 -- Not all tags that are used by the 'Operation' Object must be declared.
9494 -- The tags that are not declared MAY be organized randomly or based on the tools' logic.
9595 -- Each tag name in the list MUST be unique.
96− , _swaggerTags :: InsOrdHashSet Tag
96+ , _openApiTags :: InsOrdHashSet Tag
9797
9898 -- | Additional external documentation.
99− , _swaggerExternalDocs :: Maybe ExternalDocs
99+ , _openApiExternalDocs :: Maybe ExternalDocs
100100 } deriving (Eq, Show, Generic, Data, Typeable)
101101
102102-- | The object provides metadata about the API.
@@ -571,27 +571,27 @@ data Link = Link
571571 , _linkServer :: Maybe Server
572572 } deriving (Eq, Show, Generic, Typeable, Data)
573573
574−-- | Items for @'SwaggerArray'@ schemas.
574+-- | Items for @'OpenApiArray'@ schemas.
575575--
576576-- __Warning__: OpenAPI 3.0 does not support tuple arrays. However, OpenAPI 3.1 will, as
577577-- it will incorporate Json Schema mostly verbatim.
578578--
579−-- @'SwaggerItemsObject'@ should be used to specify homogenous array @'Schema'@s.
579+-- @'OpenApiItemsObject'@ should be used to specify homogenous array @'Schema'@s.
580580--
581−-- @'SwaggerItemsArray'@ should be used to specify tuple @'Schema'@s.
582−data SwaggerItems where
583− SwaggerItemsObject :: Referenced Schema -> SwaggerItems
584− SwaggerItemsArray :: [Referenced Schema] -> SwaggerItems
581+-- @'OpenApiItemsArray'@ should be used to specify tuple @'Schema'@s.
582+data OpenApiItems where
583+ OpenApiItemsObject :: Referenced Schema -> OpenApiItems
584+ OpenApiItemsArray :: [Referenced Schema] -> OpenApiItems
585585 deriving (Eq, Show, Typeable, Data)
586586
587−data SwaggerType where
588− SwaggerString :: SwaggerType
589− SwaggerNumber :: SwaggerType
590− SwaggerInteger :: SwaggerType
591− SwaggerBoolean :: SwaggerType
592− SwaggerArray :: SwaggerType
593− SwaggerNull :: SwaggerType
594− SwaggerObject :: SwaggerType
587+data OpenApiType where
588+ OpenApiString :: OpenApiType
589+ OpenApiNumber :: OpenApiType
590+ OpenApiInteger :: OpenApiType
591+ OpenApiBoolean :: OpenApiType
592+ OpenApiArray :: OpenApiType
593+ OpenApiNull :: OpenApiType
594+ OpenApiObject :: OpenApiType
595595 deriving (Eq, Show, Typeable, Generic, Data)
596596
597597data ParamLocation
@@ -643,9 +643,9 @@ data Schema = Schema
643643 -- Unlike JSON Schema this value MUST conform to the defined type for this parameter.
644644 _schemaDefault :: Maybe Value
645645
646− , _schemaType :: Maybe SwaggerType
646+ , _schemaType :: Maybe OpenApiType
647647 , _schemaFormat :: Maybe Format
648− , _schemaItems :: Maybe SwaggerItems
648+ , _schemaItems :: Maybe OpenApiItems
649649 , _schemaMaximum :: Maybe Scientific
650650 , _schemaExclusiveMaximum :: Maybe Bool
651651 , _schemaMinimum :: Maybe Scientific
@@ -680,7 +680,7 @@ data NamedSchema = NamedSchema
680680
681681data Xml = Xml
682682 { -- | Replaces the name of the element/attribute used for the described schema property.
683− -- When defined within the @'SwaggerItems'@ (items), it will affect the name of the individual XML elements within the list.
683+ -- When defined within the @'OpenApiItems'@ (items), it will affect the name of the individual XML elements within the list.
684684 -- When defined alongside type being array (outside the items),
685685 -- it will affect the wrapping element and only if wrapped is true.
686686 -- If wrapped is false, it will be ignored.
@@ -936,7 +936,7 @@ deriveGeneric ''MediaTypeObject
936936deriveGeneric ''Responses
937937deriveGeneric ''SecurityScheme
938938deriveGeneric ''Schema
939−deriveGeneric ''Swagger
939+deriveGeneric ''OpenApi
940940deriveGeneric ''Example
941941deriveGeneric ''Encoding
942942deriveGeneric ''Link
@@ -945,9 +945,9 @@ deriveGeneric ''Link
945945-- Monoid instances
946946-- =======================================================================
947947
948−instance Semigroup Swagger where
948+instance Semigroup OpenApi where
949949 (<>) = genericMappend
950−instance Monoid Swagger where
950+instance Monoid OpenApi where
951951 mempty = genericMempty
952952 mappend = (<>)
953953
@@ -1085,8 +1085,8 @@ instance (Eq a, Hashable a) => SwaggerMonoid (InsOrdHashSet a)
10851085instance SwaggerMonoid MimeList
10861086deriving instance SwaggerMonoid URL
10871087
1088−instance SwaggerMonoid SwaggerType where
1089− swaggerMempty = SwaggerString
1088+instance SwaggerMonoid OpenApiType where
1089+ swaggerMempty = OpenApiString
10901090 swaggerMappend _ y = y
10911091
10921092instance SwaggerMonoid ParamLocation where
@@ -1109,7 +1109,7 @@ instance Monoid a => SwaggerMonoid (Referenced a) where
11091109instance ToJSON Style where
11101110 toJSON = genericToJSON (jsonPrefix "Style")
11111111
1112−instance ToJSON SwaggerType where
1112+instance ToJSON OpenApiType where
11131113 toJSON = genericToJSON (jsonPrefix "Swagger")
11141114
11151115instance ToJSON ParamLocation where
@@ -1164,7 +1164,7 @@ instance ToJSON OAuth2AuthorizationCodeFlow where
11641164instance FromJSON Style where
11651165 parseJSON = genericParseJSON (jsonPrefix "Style")
11661166
1167−instance FromJSON SwaggerType where
1167+instance FromJSON OpenApiType where
11681168 parseJSON = genericParseJSON (jsonPrefix "Swagger")
11691169
11701170instance FromJSON ParamLocation where
@@ -1243,9 +1243,9 @@ instance ToJSON SecuritySchemeType where
12431243 , "openIdConnectUrl" .= url
12441244 ]
12451245
1246−instance ToJSON Swagger where
1246+instance ToJSON OpenApi where
12471247 toJSON a = sopSwaggerGenericToJSON a &
1248− if InsOrdHashMap.null (_swaggerPaths a)
1248+ if InsOrdHashMap.null (_openApiPaths a)
12491249 then (<+> object ["paths" .= object []])
12501250 else id
12511251 toEncoding = sopSwaggerGenericToEncoding
@@ -1269,17 +1269,17 @@ instance ToJSON Header where
12691269-- | As for nullary schema for 0-arity type constructors, see
12701270-- <https://github.com/GetShopTV/swagger2/issues/167>.
12711271--
1272−-- >>> encode (SwaggerItemsArray [])
1272+-- >>> encode (OpenApiItemsArray [])
12731273-- "{\"example\":[],\"items\":{},\"maxItems\":0}"
12741274--
1275−instance ToJSON SwaggerItems where
1276− toJSON (SwaggerItemsObject x) = object [ "items" .= x ]
1277− toJSON (SwaggerItemsArray []) = object
1275+instance ToJSON OpenApiItems where
1276+ toJSON (OpenApiItemsObject x) = object [ "items" .= x ]
1277+ toJSON (OpenApiItemsArray []) = object
12781278 [ "items" .= object []
12791279 , "maxItems" .= (0 :: Int)
12801280 , "example" .= Array mempty
12811281 ]
1282− toJSON (SwaggerItemsArray x) = object [ "items" .= x ]
1282+ toJSON (OpenApiItemsArray x) = object [ "items" .= x ]
12831283
12841284instance ToJSON Components where
12851285 toJSON = sopSwaggerGenericToJSON
@@ -1386,7 +1386,7 @@ instance FromJSON SecuritySchemeType where
13861386 _ -> empty
13871387 parseJSON _ = empty
13881388
1389−instance FromJSON Swagger where
1389+instance FromJSON OpenApi where
13901390 parseJSON = sopSwaggerGenericParseJSON
13911391
13921392instance FromJSON Server where
@@ -1399,7 +1399,7 @@ instance FromJSON Schema where
13991399 parseJSON = fmap nullaryCleanup . sopSwaggerGenericParseJSON
14001400 where nullaryCleanup :: Schema -> Schema
14011401 nullaryCleanup s =
1402− if _schemaItems s == Just (SwaggerItemsArray [])
1402+ if _schemaItems s == Just (OpenApiItemsArray [])
14031403 then s { _schemaExample = Nothing
14041404 , _schemaMaxItems = Nothing
14051405 }
@@ -1408,11 +1408,11 @@ instance FromJSON Schema where
14081408instance FromJSON Header where
14091409 parseJSON = sopSwaggerGenericParseJSON
14101410
1411−instance FromJSON SwaggerItems where
1411+instance FromJSON OpenApiItems where
14121412 parseJSON js@(Object obj)
1413− | null obj = pure $ SwaggerItemsArray [] -- Nullary schema.
1414− | otherwise = SwaggerItemsObject <$> parseJSON js
1415− parseJSON js@(Array _) = SwaggerItemsArray <$> parseJSON js
1413+ | null obj = pure $ OpenApiItemsArray [] -- Nullary schema.
1414+ | otherwise = OpenApiItemsObject <$> parseJSON js
1415+ parseJSON js@(Array _) = OpenApiItemsArray <$> parseJSON js
14161416 parseJSON _ = empty
14171417
14181418instance FromJSON Components where
@@ -1526,7 +1526,7 @@ instance HasSwaggerAesonOptions SecurityScheme where
15261526 swaggerAesonOptions _ = mkSwaggerAesonOptions "securityScheme" & saoSubObject ?~ "type"
15271527instance HasSwaggerAesonOptions Schema where
15281528 swaggerAesonOptions _ = mkSwaggerAesonOptions "schema" & saoSubObject ?~ "paramSchema"
1529−instance HasSwaggerAesonOptions Swagger where
1529+instance HasSwaggerAesonOptions OpenApi where
15301530 swaggerAesonOptions _ = mkSwaggerAesonOptions "swagger" & saoAdditionalPairs .~ [("openapi", "3.0.0")]
15311531instance HasSwaggerAesonOptions Example where
15321532 swaggerAesonOptions _ = mkSwaggerAesonOptions "example"
@@ -1545,7 +1545,7 @@ instance AesonDefaultValue OAuth2AuthorizationCodeFlow
15451545instance AesonDefaultValue p => AesonDefaultValue (OAuth2Flow p)
15461546instance AesonDefaultValue Responses
15471547instance AesonDefaultValue SecuritySchemeType
1548−instance AesonDefaultValue SwaggerType
1548+instance AesonDefaultValue OpenApiType
15491549instance AesonDefaultValue MimeList where defaultValue = Just mempty
15501550instance AesonDefaultValue Info
15511551instance AesonDefaultValue ParamLocation
src/Data/OpenApi/Internal/ParamSchema.hs+22−22
@@ -52,20 +52,20 @@ import GHC.TypeLits (TypeError, ErrorMessage(..))
5252-- | Default schema for binary data (any sequence of octets).
5353binarySchema :: Schema
5454binarySchema = mempty
55− & type_ ?~ SwaggerString
55+ & type_ ?~ OpenApiString
5656 & format ?~ "binary"
5757
5858-- | Default schema for binary data (base64 encoded).
5959byteSchema :: Schema
6060byteSchema = mempty
61− & type_ ?~ SwaggerString
61+ & type_ ?~ OpenApiString
6262 & format ?~ "byte"
6363
6464-- | Default schema for password string.
6565-- @"password"@ format is used to hint UIs the input needs to be obscured.
6666passwordSchema :: Schema
6767passwordSchema = mempty
68− & type_ ?~ SwaggerString
68+ & type_ ?~ OpenApiString
6969 & format ?~ "password"
7070
7171-- | Convert a type into a plain @'Schema'@.
@@ -87,7 +87,7 @@ passwordSchema = mempty
8787--
8888-- instance ToParamSchema Direction where
8989-- toParamSchema _ = mempty
90−-- & type_ ?~ SwaggerString
90+-- & type_ ?~ OpenApiString
9191-- & enum_ ?~ [ \"Up\", \"Down\" ]
9292-- @
9393--
@@ -119,17 +119,17 @@ class ToParamSchema a where
119119 toParamSchema = genericToParamSchema defaultSchemaOptions
120120
121121instance {-# OVERLAPPING #-} ToParamSchema String where
122− toParamSchema _ = mempty & type_ ?~ SwaggerString
122+ toParamSchema _ = mempty & type_ ?~ OpenApiString
123123
124124instance ToParamSchema Bool where
125− toParamSchema _ = mempty & type_ ?~ SwaggerBoolean
125+ toParamSchema _ = mempty & type_ ?~ OpenApiBoolean
126126
127127instance ToParamSchema Integer where
128− toParamSchema _ = mempty & type_ ?~ SwaggerInteger
128+ toParamSchema _ = mempty & type_ ?~ OpenApiInteger
129129
130130instance ToParamSchema Natural where
131131 toParamSchema _ = mempty
132− & type_ ?~ SwaggerInteger
132+ & type_ ?~ OpenApiInteger
133133 & minimum_ ?~ 0
134134 & exclusiveMinimum ?~ False
135135
@@ -159,37 +159,37 @@ instance ToParamSchema Word64 where
159159-- "{\"maximum\":127,\"minimum\":-128,\"type\":\"integer\"}"
160160toParamSchemaBoundedIntegral :: forall a t. (Bounded a, Integral a) => Proxy a -> Schema
161161toParamSchemaBoundedIntegral _ = mempty
162− & type_ ?~ SwaggerInteger
162+ & type_ ?~ OpenApiInteger
163163 & minimum_ ?~ fromInteger (toInteger (minBound :: a))
164164 & maximum_ ?~ fromInteger (toInteger (maxBound :: a))
165165
166166instance ToParamSchema Char where
167167 toParamSchema _ = mempty
168− & type_ ?~ SwaggerString
168+ & type_ ?~ OpenApiString
169169 & maxLength ?~ 1
170170 & minLength ?~ 1
171171
172172instance ToParamSchema Scientific where
173− toParamSchema _ = mempty & type_ ?~ SwaggerNumber
173+ toParamSchema _ = mempty & type_ ?~ OpenApiNumber
174174
175175instance HasResolution a => ToParamSchema (Fixed a) where
176176 toParamSchema _ = mempty
177− & type_ ?~ SwaggerNumber
177+ & type_ ?~ OpenApiNumber
178178 & multipleOf ?~ (recip . fromInteger $ resolution (Proxy :: Proxy a))
179179
180180instance ToParamSchema Double where
181181 toParamSchema _ = mempty
182− & type_ ?~ SwaggerNumber
182+ & type_ ?~ OpenApiNumber
183183 & format ?~ "double"
184184
185185instance ToParamSchema Float where
186186 toParamSchema _ = mempty
187− & type_ ?~ SwaggerNumber
187+ & type_ ?~ OpenApiNumber
188188 & format ?~ "float"
189189
190190timeParamSchema :: String -> Schema
191191timeParamSchema fmt = mempty
192− & type_ ?~ SwaggerString
192+ & type_ ?~ OpenApiString
193193 & format ?~ T.pack fmt
194194
195195-- | Format @"date"@ corresponds to @yyyy-mm-dd@ format.
@@ -231,12 +231,12 @@ instance ToParamSchema TL.Text where
231231
232232instance ToParamSchema Version where
233233 toParamSchema _ = mempty
234− & type_ ?~ SwaggerString
234+ & type_ ?~ OpenApiString
235235 & pattern ?~ "^\\d+(\\.\\d+)*$"
236236
237237instance ToParamSchema SetCookie where
238238 toParamSchema _ = mempty
239− & type_ ?~ SwaggerString
239+ & type_ ?~ OpenApiString
240240
241241type family ToParamSchemaByteStringError bs where
242242 ToParamSchemaByteStringError bs = TypeError
@@ -259,8 +259,8 @@ instance ToParamSchema a => ToParamSchema (Identity a) where toParamSchema _ = t
259259
260260instance ToParamSchema a => ToParamSchema [a] where
261261 toParamSchema _ = mempty
262− & type_ ?~ SwaggerArray
263− & items ?~ SwaggerItemsObject (Inline $ toParamSchema (Proxy :: Proxy a))
262+ & type_ ?~ OpenApiArray
263+ & items ?~ OpenApiItemsObject (Inline $ toParamSchema (Proxy :: Proxy a))
264264
265265instance ToParamSchema a => ToParamSchema (V.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
266266instance ToParamSchema a => ToParamSchema (VP.Vector a) where toParamSchema _ = toParamSchema (Proxy :: Proxy [a])
@@ -279,12 +279,12 @@ instance ToParamSchema a => ToParamSchema (HashSet a) where
279279-- "{\"type\":\"string\",\"enum\":[\"_\"]}"
280280instance ToParamSchema () where
281281 toParamSchema _ = mempty
282− & type_ ?~ SwaggerString
282+ & type_ ?~ OpenApiString
283283 & enum_ ?~ ["_"]
284284
285285instance ToParamSchema UUID where
286286 toParamSchema _ = mempty
287− & type_ ?~ SwaggerString
287+ & type_ ?~ OpenApiString
288288 & format ?~ "uuid"
289289
290290-- | A configurable generic @'Schema'@ creator.
@@ -322,7 +322,7 @@ instance (GEnumParamSchema f, GEnumParamSchema g) => GEnumParamSchema (f :+: g)
322322
323323instance Constructor c => GEnumParamSchema (C1 c U1) where
324324 genumParamSchema opts _ s = s
325− & type_ ?~ SwaggerString
325+ & type_ ?~ OpenApiString
326326 & enum_ %~ addEnumValue tag
327327 where
328328 tag = toJSON (constructorTagModifier opts (conName (Proxy3 :: Proxy3 c f p)))
src/Data/OpenApi/Internal/Schema.hs+44−44
@@ -105,7 +105,7 @@ rename name (NamedSchema _ schema) = NamedSchema name schema
105105-- declareNamedSchema _ = do
106106-- doubleSchema <- declareSchemaRef (Proxy :: Proxy Double)
107107-- return $ NamedSchema (Just \"Coord\") $ mempty
108−-- & type_ ?~ SwaggerObject
108+-- & type_ ?~ OpenApiObject
109109-- & properties .~
110110-- [ (\"x\", doubleSchema)
111111-- , (\"y\", doubleSchema)
@@ -312,15 +312,15 @@ sketchSchema = sketch . toJSON
312312 sketch js@(Bool _) = go js
313313 sketch js = go js & example ?~ js
314314
315− go Null = mempty & type_ ?~ SwaggerNull
316− go (Bool _) = mempty & type_ ?~ SwaggerBoolean
317− go (String _) = mempty & type_ ?~ SwaggerString
318− go (Number _) = mempty & type_ ?~ SwaggerNumber
315+ go Null = mempty & type_ ?~ OpenApiNull
316+ go (Bool _) = mempty & type_ ?~ OpenApiBoolean
317+ go (String _) = mempty & type_ ?~ OpenApiString
318+ go (Number _) = mempty & type_ ?~ OpenApiNumber
319319 go (Array xs) = mempty
320− & type_ ?~ SwaggerArray
320+ & type_ ?~ OpenApiArray
321321 & items ?~ case ischema of
322− Just s -> SwaggerItemsObject (Inline s)
323− _ -> SwaggerItemsArray (map Inline ys)
322+ Just s -> OpenApiItemsObject (Inline s)
323+ _ -> OpenApiItemsArray (map Inline ys)
324324 where
325325 ys = map go (V.toList xs)
326326 allSame = and ((zipWith (==)) ys (tail ys))
@@ -329,7 +329,7 @@ sketchSchema = sketch . toJSON
329329 (z:_) | allSame -> Just z
330330 _ -> Nothing
331331 go (Object o) = mempty
332− & type_ ?~ SwaggerObject
332+ & type_ ?~ OpenApiObject
333333 & required .~ HashMap.keys o
334334 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
335335
@@ -352,34 +352,34 @@ sketchSchema = sketch . toJSON
352352sketchStrictSchema :: ToJSON a => a -> Schema
353353sketchStrictSchema = go . toJSON
354354 where
355− go Null = mempty & type_ ?~ SwaggerNull
355+ go Null = mempty & type_ ?~ OpenApiNull
356356 go js@(Bool _) = mempty
357− & type_ ?~ SwaggerBoolean
357+ & type_ ?~ OpenApiBoolean
358358 & enum_ ?~ [js]
359359 go js@(String s) = mempty
360− & type_ ?~ SwaggerString
360+ & type_ ?~ OpenApiString
361361 & maxLength ?~ fromIntegral (T.length s)
362362 & minLength ?~ fromIntegral (T.length s)
363363 & pattern ?~ s
364364 & enum_ ?~ [js]
365365 go js@(Number n) = mempty
366− & type_ ?~ SwaggerNumber
366+ & type_ ?~ OpenApiNumber
367367 & maximum_ ?~ n
368368 & minimum_ ?~ n
369369 & multipleOf ?~ n
370370 & enum_ ?~ [js]
371371 go js@(Array xs) = mempty
372− & type_ ?~ SwaggerArray
372+ & type_ ?~ OpenApiArray
373373 & maxItems ?~ fromIntegral sz
374374 & minItems ?~ fromIntegral sz
375− & items ?~ SwaggerItemsArray (map (Inline . go) (V.toList xs))
375+ & items ?~ OpenApiItemsArray (map (Inline . go) (V.toList xs))
376376 & uniqueItems ?~ allUnique
377377 & enum_ ?~ [js]
378378 where
379379 sz = length xs
380380 allUnique = sz == HashSet.size (HashSet.fromList (V.toList xs))
381381 go js@(Object o) = mempty
382− & type_ ?~ SwaggerObject
382+ & type_ ?~ OpenApiObject
383383 & required .~ names
384384 & properties .~ fmap (Inline . go) (InsOrdHashMap.fromHashMap o)
385385 & maxProperties ?~ fromIntegral (length names)
@@ -395,8 +395,8 @@ instance {-# OVERLAPPABLE #-} ToSchema a => ToSchema [a] where
395395 declareNamedSchema _ = do
396396 ref <- declareSchemaRef (Proxy :: Proxy a)
397397 return $ unnamed $ mempty
398− & type_ ?~ SwaggerArray
399− & items ?~ SwaggerItemsObject ref
398+ & type_ ?~ OpenApiArray
399+ & items ?~ OpenApiItemsObject ref
400400
401401instance {-# OVERLAPPING #-} ToSchema String where declareNamedSchema = plain . paramSchemaToSchema
402402instance ToSchema Bool where declareNamedSchema = plain . paramSchemaToSchema
@@ -447,7 +447,7 @@ instance (ToSchema a, ToSchema b, ToSchema c, ToSchema d, ToSchema e, ToSchema f
447447
448448timeSchema :: T.Text -> Schema
449449timeSchema fmt = mempty
450− & type_ ?~ SwaggerString
450+ & type_ ?~ OpenApiString
451451 & format ?~ fmt
452452
453453-- | Format @"date"@ corresponds to @yyyy-mm-dd@ format.
@@ -505,7 +505,7 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (Map k v) where
505505 declareObjectMapSchema = do
506506 schema <- declareSchemaRef (Proxy :: Proxy v)
507507 return $ unnamed $ mempty
508− & type_ ?~ SwaggerObject
508+ & type_ ?~ OpenApiObject
509509 & additionalProperties ?~ AdditionalPropertiesSchema schema
510510
511511instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
@@ -513,7 +513,7 @@ instance (ToJSONKey k, ToSchema k, ToSchema v) => ToSchema (HashMap k v) where
513513
514514instance {-# OVERLAPPING #-} ToSchema Object where
515515 declareNamedSchema _ = pure $ NamedSchema (Just "Object") $ mempty
516− & type_ ?~ SwaggerObject
516+ & type_ ?~ OpenApiObject
517517 & description ?~ "Arbitrary JSON object."
518518 & additionalProperties ?~ AdditionalPropertiesAllowed True
519519
@@ -554,7 +554,7 @@ instance ToSchema a => ToSchema (Identity a) where declareNamedSchema _ = declar
554554-- {"maximum":32767,"minimum":-32768,"type":"integer"}
555555toSchemaBoundedIntegral :: forall a. (Bounded a, Integral a) => Proxy a -> Schema
556556toSchemaBoundedIntegral _ = mempty
557− & type_ ?~ SwaggerInteger
557+ & type_ ?~ OpenApiInteger
558558 & minimum_ ?~ fromInteger (toInteger (minBound :: a))
559559 & maximum_ ?~ fromInteger (toInteger (maxBound :: a))
560560
@@ -600,7 +600,7 @@ declareSchemaBoundedEnumKeyMapping _ = case toJSONKey :: ToJSONKeyFunction key o
600600 let allKeys = [minBound..maxBound :: key]
601601 mkPair k = (keyToText k, valueRef)
602602 return $ mempty
603− & type_ ?~ SwaggerObject
603+ & type_ ?~ OpenApiObject
604604 & properties .~ InsOrdHashMap.fromList (map mkPair allKeys)
605605
606606-- | A 'Schema' for a mapping with 'Bounded' 'Enum' keys.
@@ -659,8 +659,8 @@ paramSchemaToSchema = toParamSchema
659659
660660nullarySchema :: Schema
661661nullarySchema = mempty
662− & type_ ?~ SwaggerArray
663− & items ?~ SwaggerItemsArray []
662+ & type_ ?~ OpenApiArray
663+ & items ?~ OpenApiItemsArray []
664664
665665gtoNamedSchema :: GToSchema f => SchemaOptions -> Proxy f -> NamedSchema
666666gtoNamedSchema opts proxy = undeclare $ gdeclareNamedSchema opts proxy mempty
@@ -690,7 +690,7 @@ instance (Selector s, GToSchema f, GToSchema (S1 s f)) => GToSchema (C1 c (S1 s
690690 | unwrapUnaryRecords opts = fieldSchema
691691 | otherwise =
692692 case schema ^. items of
693− Just (SwaggerItemsArray [_]) -> fieldSchema
693+ Just (OpenApiItemsArray [_]) -> fieldSchema
694694 _ -> do
695695 declare defs
696696 return (unnamed schema)
@@ -718,10 +718,10 @@ gdeclareSchemaRef opts proxy = do
718718 return $ Ref (Reference name)
719719 _ -> Inline <$> gdeclareSchema opts proxy
720720
721−appendItem :: Referenced Schema -> Maybe SwaggerItems -> Maybe SwaggerItems
722−appendItem x Nothing = Just (SwaggerItemsArray [x])
723−appendItem x (Just (SwaggerItemsArray xs)) = Just (SwaggerItemsArray (xs ++ [x]))
724−appendItem _ _ = error "GToSchema.appendItem: cannot append to SwaggerItemsObject"
721+appendItem :: Referenced Schema -> Maybe OpenApiItems -> Maybe OpenApiItems
722+appendItem x Nothing = Just (OpenApiItemsArray [x])
723+appendItem x (Just (OpenApiItemsArray xs)) = Just (OpenApiItemsArray (xs ++ [x]))
724+appendItem _ _ = error "GToSchema.appendItem: cannot append to OpenApiItemsObject"
725725
726726withFieldSchema :: forall proxy s f. (Selector s, GToSchema f) =>
727727 SchemaOptions -> proxy s f -> Bool -> Schema -> Declare (Definitions Schema) Schema
@@ -730,12 +730,12 @@ withFieldSchema opts _ isRequiredField schema = do
730730 return $
731731 if T.null fname
732732 then schema
733− & type_ ?~ SwaggerArray
733+ & type_ ?~ OpenApiArray
734734 & items %~ appendItem ref
735735 & maxItems %~ Just . maybe 1 (+1) -- increment maxItems
736736 & minItems %~ Just . maybe 1 (+1) -- increment minItems
737737 else schema
738− & type_ ?~ SwaggerObject
738+ & type_ ?~ OpenApiObject
739739 & properties . at fname ?~ ref
740740 & if isRequiredField
741741 then required %~ (++ [fname])
@@ -770,14 +770,14 @@ gdeclareNamedSumSchema opts proxy _
770770 | otherwise = do
771771 (schemas, _) <- runWriterT declareSumSchema
772772 return $ unnamed $ mempty
773− & type_ ?~ SwaggerObject
773+ & type_ ?~ OpenApiObject
774774 & oneOf ?~ (snd <$> schemas)
775775 where
776776 declareSumSchema = gsumToSchema opts proxy
777777 (sumSchemas, All allNullary) = undeclare (runWriterT declareSumSchema)
778778
779779 toStringTag schemas = mempty
780− & type_ ?~ SwaggerString
780+ & type_ ?~ OpenApiString
781781 & enum_ ?~ map (String . fst) sumSchemas
782782
783783type AllNullary = All
@@ -799,15 +799,15 @@ gsumConToSchemaWith ref opts _ = (tag, schema)
799799 case ref of
800800 -- If subschema is an object and constructor is a record, we add tag directly
801801 -- to the record, as Aeson does it.
802− Just (Inline sub) | sub ^. type_ == Just SwaggerObject && isRecord -> Inline $ sub
802+ Just (Inline sub) | sub ^. type_ == Just OpenApiObject && isRecord -> Inline $ sub
803803 & required <>~ [T.pack tagField]
804− & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ SwaggerString & enum_ ?~ [String tag])
804+ & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ OpenApiString & enum_ ?~ [String tag])
805805
806806 -- If it is not a record, we need to put subschema into "contents" field.
807807 _ | not isRecord -> Inline $ mempty
808− & type_ ?~ SwaggerObject
808+ & type_ ?~ OpenApiObject
809809 & required .~ [T.pack tagField]
810− & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ SwaggerString & enum_ ?~ [String tag])
810+ & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ OpenApiString & enum_ ?~ [String tag])
811811 -- If constructor is nullary, there is no content.
812812 & case ref of
813813 Just r -> (properties . at (T.pack contentsField) ?~ r) . (required <>~ [T.pack contentsField])
@@ -815,17 +815,17 @@ gsumConToSchemaWith ref opts _ = (tag, schema)
815815
816816 -- In the remaining cases we combine "tag" object and "contents" object using allOf.
817817 _ -> Inline $ mempty
818− & type_ ?~ SwaggerObject
818+ & type_ ?~ OpenApiObject
819819 & allOf ?~ [Inline $ mempty
820− & type_ ?~ SwaggerObject
820+ & type_ ?~ OpenApiObject
821821 & required .~ (T.pack tagField : if isRecord then [] else [T.pack contentsField])
822− & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ SwaggerString & enum_ ?~ [String tag])]
822+ & properties . at (T.pack tagField) ?~ (Inline $ mempty & type_ ?~ OpenApiString & enum_ ?~ [String tag])]
823823 & if isRecord
824824 then allOf . _Just <>~ [refOrNullary]
825− else allOf . _Just <>~ [Inline $ mempty & type_ ?~ SwaggerObject & properties . at (T.pack contentsField) ?~ refOrNullary]
825+ else allOf . _Just <>~ [Inline $ mempty & type_ ?~ OpenApiObject & properties . at (T.pack contentsField) ?~ refOrNullary]
826826 UntaggedValue -> refOrEnum -- Aeson encodes nullary constructors as strings in this case.
827827 ObjectWithSingleField -> Inline $ mempty
828− & type_ ?~ SwaggerObject
828+ & type_ ?~ OpenApiObject
829829 & required .~ [tag]
830830 & properties . at tag ?~ refOrNullary
831831 TwoElemArray -> error "unrepresentable in OpenAPI 3"
@@ -833,7 +833,7 @@ gsumConToSchemaWith ref opts _ = (tag, schema)
833833 tag = T.pack (constructorTagModifier opts (conName (Proxy3 :: Proxy3 c f p)))
834834 isRecord = conIsRecord (Proxy3 :: Proxy3 c f p)
835835 refOrNullary = fromMaybe (Inline nullarySchema) ref
836− refOrEnum = fromMaybe (Inline $ mempty & type_ ?~ SwaggerString & enum_ ?~ [String tag]) ref
836+ refOrEnum = fromMaybe (Inline $ mempty & type_ ?~ OpenApiString & enum_ ?~ [String tag]) ref
837837
838838gsumConToSchema :: (GToSchema (C1 c f), Constructor c) =>
839839 SchemaOptions -> Proxy (C1 c f) -> Declare (Definitions Schema) [(T.Text, Referenced Schema)]
src/Data/OpenApi/Internal/Schema/Validation.hs+33−33
@@ -353,8 +353,8 @@ validateArray xs = do
353353 invalid ("array is too short (size should be >=" ++ show n ++ ")")
354354
355355 check items $ \case
356− SwaggerItemsObject itemSchema -> traverse_ (validateWithSchemaRef itemSchema) xs
357− SwaggerItemsArray itemSchemas -> do
356+ OpenApiItemsObject itemSchema -> traverse_ (validateWithSchemaRef itemSchema) xs
357+ OpenApiItemsArray itemSchemas -> do
358358 when (len /= length itemSchemas) $
359359 invalid ("array size is invalid (should be exactly " ++ show (length itemSchemas) ++ ")")
360360 sequenceA_ (zipWith validateWithSchemaRef itemSchemas (Vector.toList xs))
@@ -423,10 +423,10 @@ validateEnum val = do
423423-- This is like 'inferParamSchemaTypes', but also works for objects:
424424--
425425-- >>> inferSchemaTypes <$> decode "{\"minProperties\": 1}"
426−-- Just [SwaggerObject]
427−inferSchemaTypes :: Schema -> [SwaggerType]
426+-- Just [OpenApiObject]
427+inferSchemaTypes :: Schema -> [OpenApiType]
428428inferSchemaTypes sch = inferParamSchemaTypes sch ++
429− [ SwaggerObject | any ($ sch)
429+ [ OpenApiObject | any ($ sch)
430430 [ has (additionalProperties._Just)
431431 , has (maxProperties._Just)
432432 , has (minProperties._Just)
@@ -436,30 +436,30 @@ inferSchemaTypes sch = inferParamSchemaTypes sch ++
436436-- | Infer schema type based on used properties.
437437--
438438-- >>> inferSchemaTypes <$> decode "{\"minLength\": 2}"
439−-- Just [SwaggerString]
439+-- Just [OpenApiString]
440440--
441441-- >>> inferSchemaTypes <$> decode "{\"maxItems\": 0}"
442−-- Just [SwaggerArray]
442+-- Just [OpenApiArray]
443443--
444−-- From numeric properties 'SwaggerInteger' type is inferred.
445−-- If you want 'SwaggerNumber' instead, you must specify it explicitly.
444+-- From numeric properties 'OpenApiInteger' type is inferred.
445+-- If you want 'OpenApiNumber' instead, you must specify it explicitly.
446446--
447447-- >>> inferSchemaTypes <$> decode "{\"minimum\": 1}"
448−-- Just [SwaggerInteger]
449−inferParamSchemaTypes :: Schema -> [SwaggerType]
448+-- Just [OpenApiInteger]
449+inferParamSchemaTypes :: Schema -> [OpenApiType]
450450inferParamSchemaTypes sch = concat
451− [ [ SwaggerArray | any ($ sch)
451+ [ [ OpenApiArray | any ($ sch)
452452 [ has (items._Just)
453453 , has (maxItems._Just)
454454 , has (minItems._Just)
455455 , has (uniqueItems._Just) ] ]
456− , [ SwaggerInteger | any ($ sch)
456+ , [ OpenApiInteger | any ($ sch)
457457 [ has (exclusiveMaximum._Just)
458458 , has (exclusiveMinimum._Just)
459459 , has (maximum_._Just)
460460 , has (minimum_._Just)
461461 , has (multipleOf._Just) ] ]
462− , [ SwaggerString | any ($ sch)
462+ , [ OpenApiString | any ($ sch)
463463 [ has (maxLength._Just)
464464 , has (minLength._Just)
465465 , has (pattern._Just) ] ]
@@ -483,13 +483,13 @@ validateSchemaType val = withSchema $ \sch ->
483483
484484 _ ->
485485 case (sch ^. type_, val) of
486− (Just SwaggerNull, Null) -> valid
487− (Just SwaggerBoolean, Bool _) -> valid
488− (Just SwaggerInteger, Number n) -> validateInteger n
489− (Just SwaggerNumber, Number n) -> validateNumber n
490− (Just SwaggerString, String s) -> validateString s
491− (Just SwaggerArray, Array xs) -> validateArray xs
492− (Just SwaggerObject, Object o) -> validateObject o
486+ (Just OpenApiNull, Null) -> valid
487+ (Just OpenApiBoolean, Bool _) -> valid
488+ (Just OpenApiInteger, Number n) -> validateInteger n
489+ (Just OpenApiNumber, Number n) -> validateNumber n
490+ (Just OpenApiString, String s) -> validateString s
491+ (Just OpenApiArray, Array xs) -> validateArray xs
492+ (Just OpenApiObject, Object o) -> validateObject o
493493 (Nothing, Null) -> valid
494494 (Nothing, Bool _) -> valid
495495 -- Number by default
@@ -502,11 +502,11 @@ validateSchemaType val = withSchema $ \sch ->
502502validateParamSchemaType :: Value -> Validation Schema ()
503503validateParamSchemaType val = withSchema $ \sch ->
504504 case (sch ^. type_, val) of
505− (Just SwaggerBoolean, Bool _) -> valid
506− (Just SwaggerInteger, Number n) -> validateInteger n
507− (Just SwaggerNumber, Number n) -> validateNumber n
508− (Just SwaggerString, String s) -> validateString s
509− (Just SwaggerArray, Array xs) -> validateArray xs
505+ (Just OpenApiBoolean, Bool _) -> valid
506+ (Just OpenApiInteger, Number n) -> validateInteger n
507+ (Just OpenApiNumber, Number n) -> validateNumber n
508+ (Just OpenApiString, String s) -> validateString s
509+ (Just OpenApiArray, Array xs) -> validateArray xs
510510 (Nothing, Bool _) -> valid
511511 -- Number by default
512512 (Nothing, Number n) -> validateNumber n
@@ -514,11 +514,11 @@ validateParamSchemaType val = withSchema $ \sch ->
514514 (Nothing, Array xs) -> validateArray xs
515515 bad -> invalid $ "expected JSON value of type " ++ showType bad
516516
517−showType :: (Maybe SwaggerType, Value) -> String
517+showType :: (Maybe OpenApiType, Value) -> String
518518showType (Just ty, _) = show ty
519−showType (Nothing, Null) = "SwaggerNull"
520−showType (Nothing, Bool _) = "SwaggerBoolean"
521−showType (Nothing, Number _) = "SwaggerNumber"
522−showType (Nothing, String _) = "SwaggerString"
523−showType (Nothing, Array _) = "SwaggerArray"
524−showType (Nothing, Object _) = "SwaggerObject"
519+showType (Nothing, Null) = "OpenApiNull"
520+showType (Nothing, Bool _) = "OpenApiBoolean"
521+showType (Nothing, Number _) = "OpenApiNumber"
522+showType (Nothing, String _) = "OpenApiString"
523+showType (Nothing, Array _) = "OpenApiArray"
524+showType (Nothing, Object _) = "OpenApiObject"
src/Data/OpenApi/Lens.hs+16−16
@@ -26,7 +26,7 @@ import Data.Text (Text)
2626
2727-- * Classy lenses
2828
29−makeFields ''Swagger
29+makeFields ''OpenApi
3030makeFields ''Components
3131makeFields ''Server
3232makeFields ''RequestBody
@@ -64,24 +64,24 @@ makePrisms ''SecuritySchemeType
6464-- ** 'Referenced' prisms
6565makePrisms ''Referenced
6666
67−-- ** 'SwaggerItems' prisms
67+-- ** 'OpenApiItems' prisms
6868
69−_SwaggerItemsArray :: Review SwaggerItems [Referenced Schema]
70−_SwaggerItemsArray
71− = unto (\x -> SwaggerItemsArray x)
69+_OpenApiItemsArray :: Review OpenApiItems [Referenced Schema]
70+_OpenApiItemsArray
71+ = unto (\x -> OpenApiItemsArray x)
7272{- \x -> case x of
73− SwaggerItemsPrimitive c p -> Left (SwaggerItemsPrimitive c p)
74− SwaggerItemsObject o -> Left (SwaggerItemsObject o)
75− SwaggerItemsArray a -> Right a
73+ OpenApiItemsPrimitive c p -> Left (OpenApiItemsPrimitive c p)
74+ OpenApiItemsObject o -> Left (OpenApiItemsObject o)
75+ OpenApiItemsArray a -> Right a
7676-}
7777
78−_SwaggerItemsObject :: Review SwaggerItems (Referenced Schema)
79−_SwaggerItemsObject
80− = unto (\x -> SwaggerItemsObject x)
78+_OpenApiItemsObject :: Review OpenApiItems (Referenced Schema)
79+_OpenApiItemsObject
80+ = unto (\x -> OpenApiItemsObject x)
8181{- \x -> case x of
82− SwaggerItemsPrimitive c p -> Left (SwaggerItemsPrimitive c p)
83− SwaggerItemsObject o -> Right o
84− SwaggerItemsArray a -> Left (SwaggerItemsArray a)
82+ OpenApiItemsPrimitive c p -> Left (OpenApiItemsPrimitive c p)
83+ OpenApiItemsObject o -> Right o
84+ OpenApiItemsArray a -> Left (OpenApiItemsArray a)
8585-}
8686
8787-- =============================================================
@@ -99,7 +99,7 @@ instance At Responses where at n = responses . at n
9999instance Ixed Operation where ix n = responses . ix n
100100instance At Operation where at n = responses . at n
101101
102−instance HasType NamedSchema (Maybe SwaggerType) where type_ = schema.type_
102+instance HasType NamedSchema (Maybe OpenApiType) where type_ = schema.type_
103103
104104-- OVERLAPPABLE instances
105105
@@ -112,7 +112,7 @@ instance
112112instance
113113 {-# OVERLAPPABLE #-}
114114 HasSchema s Schema
115− => HasItems s (Maybe SwaggerItems) where
115+ => HasItems s (Maybe OpenApiItems) where
116116 items = schema.items
117117
118118instance
src/Data/OpenApi/Operation.hs+13−13
@@ -59,10 +59,10 @@ import qualified Data.HashSet.InsOrd as InsOrdHS
5959-- | Prepend path piece to all operations of the spec.
6060-- Leading and trailing slashes are trimmed/added automatically.
6161--
62−-- >>> let api = (mempty :: Swagger) & paths .~ [("/info", mempty)]
62+-- >>> let api = (mempty :: OpenApi) & paths .~ [("/info", mempty)]
6363-- >>> BSL.putStrLn $ encode $ prependPath "user/{user_id}" api ^. paths
6464-- {"/user/{user_id}/info":{}}
65−prependPath :: FilePath -> Swagger -> Swagger
65+prependPath :: FilePath -> OpenApi -> OpenApi
6666prependPath path = paths %~ InsOrdHashMap.mapKeys (path </>)
6767 where
6868 x </> y = case trim y of
@@ -72,7 +72,7 @@ prependPath path = paths %~ InsOrdHashMap.mapKeys (path </>)
7272 trim = dropWhile (== '/') . dropWhileEnd (== '/')
7373
7474-- | All operations of a Swagger spec.
75−allOperations :: Traversal' Swagger Operation
75+allOperations :: Traversal' OpenApi Operation
7676allOperations = paths.traverse.template
7777
7878-- | @'operationsOf' sub@ will traverse only those operations
@@ -80,13 +80,13 @@ allOperations = paths.traverse.template
8080-- by both path and method.
8181--
8282-- >>> let ok = (mempty :: Operation) & at 200 ?~ "OK"
83−-- >>> let api = (mempty :: Swagger) & paths .~ [("/user", mempty & get ?~ ok & post ?~ ok)]
84−-- >>> let sub = (mempty :: Swagger) & paths .~ [("/user", mempty & get ?~ mempty)]
83+-- >>> let api = (mempty :: OpenApi) & paths .~ [("/user", mempty & get ?~ ok & post ?~ ok)]
84+-- >>> let sub = (mempty :: OpenApi) & paths .~ [("/user", mempty & get ?~ mempty)]
8585-- >>> BSL.putStrLn $ encode api
8686-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/user":{"get":{"responses":{"200":{"description":"OK"}}},"post":{"responses":{"200":{"description":"OK"}}}}},"components":{}}
8787-- >>> BSL.putStrLn $ encode $ api & operationsOf sub . at 404 ?~ "Not found"
8888-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/user":{"get":{"responses":{"404":{"description":"Not found"},"200":{"description":"OK"}}},"post":{"responses":{"200":{"description":"OK"}}}}},"components":{}}
89−operationsOf :: Swagger -> Traversal' Swagger Operation
89+operationsOf :: OpenApi -> Traversal' OpenApi Operation
9090operationsOf sub = paths.itraversed.withIndex.subops
9191 where
9292 -- | Traverse operations that correspond to paths and methods of the sub API.
@@ -108,12 +108,12 @@ operationsOf sub = paths.itraversed.withIndex.subops
108108-- @
109109-- 'applyTags' = 'applyTagsFor' 'allOperations'
110110-- @
111−applyTags :: [Tag] -> Swagger -> Swagger
111+applyTags :: [Tag] -> OpenApi -> OpenApi
112112applyTags = applyTagsFor allOperations
113113
114114-- | Apply tags to a part of Swagger spec and update the global
115115-- list of tags.
116−applyTagsFor :: Traversal' Swagger Operation -> [Tag] -> Swagger -> Swagger
116+applyTagsFor :: Traversal' OpenApi Operation -> [Tag] -> OpenApi -> OpenApi
117117applyTagsFor ops ts swag = swag
118118 & ops . tags %~ (<> InsOrdHS.fromList (map _tagName ts))
119119 & tags %~ (<> InsOrdHS.fromList ts)
@@ -141,13 +141,13 @@ declareResponse cType proxy = do
141141--
142142-- Example:
143143--
144−-- >>> let api = (mempty :: Swagger) & paths .~ [("/user", mempty & get ?~ mempty)]
144+-- >>> let api = (mempty :: OpenApi) & paths .~ [("/user", mempty & get ?~ mempty)]
145145-- >>> let res = declareResponse "application/json" (Proxy :: Proxy Day)
146146-- >>> BSL.putStrLn $ encode $ api & setResponse 200 res
147147-- {"openapi":"3.0.0","info":{"version":"","title":""},"paths":{"/user":{"get":{"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Day"}}},"description":""}}}}},"components":{"schemas":{"Day":{"example":"2016-07-22","format":"date","type":"string"}}}}
148148--
149149-- See also @'setResponseWith'@.
150−setResponse :: HttpStatusCode -> Declare (Definitions Schema) Response -> Swagger -> Swagger
150+setResponse :: HttpStatusCode -> Declare (Definitions Schema) Response -> OpenApi -> OpenApi
151151setResponse = setResponseFor allOperations
152152
153153-- | Set or update response for all operations.
@@ -161,7 +161,7 @@ setResponse = setResponseFor allOperations
161161-- @
162162--
163163-- See also @'setResponse'@.
164−setResponseWith :: (Response -> Response -> Response) -> HttpStatusCode -> Declare (Definitions Schema) Response -> Swagger -> Swagger
164+setResponseWith :: (Response -> Response -> Response) -> HttpStatusCode -> Declare (Definitions Schema) Response -> OpenApi -> OpenApi
165165setResponseWith = setResponseForWith allOperations
166166
167167-- | Set response for specified operations.
@@ -170,7 +170,7 @@ setResponseWith = setResponseForWith allOperations
170170-- If the response already exists it will be overwritten.
171171--
172172-- See also @'setResponseForWith'@.
173−setResponseFor :: Traversal' Swagger Operation -> HttpStatusCode -> Declare (Definitions Schema) Response -> Swagger -> Swagger
173+setResponseFor :: Traversal' OpenApi Operation -> HttpStatusCode -> Declare (Definitions Schema) Response -> OpenApi -> OpenApi
174174setResponseFor ops code dres swag = swag
175175 & components.schemas %~ (<> defs)
176176 & ops . at code ?~ Inline res
@@ -184,7 +184,7 @@ setResponseFor ops code dres swag = swag
184184-- then just the new response is used.
185185--
186186-- See also @'setResponseFor'@.
187−setResponseForWith :: Traversal' Swagger Operation -> (Response -> Response -> Response) -> HttpStatusCode -> Declare (Definitions Schema) Response -> Swagger -> Swagger
187+setResponseForWith :: Traversal' OpenApi Operation -> (Response -> Response -> Response) -> HttpStatusCode -> Declare (Definitions Schema) Response -> OpenApi -> OpenApi
188188setResponseForWith ops f code dres swag = swag
189189 & components.schemas %~ (<> defs)
190190 & ops . at code %~ Just . Inline . combine
src/Data/OpenApi/Optics.hs+17−17
@@ -22,8 +22,8 @@
2222-- Example from the "Data.OpenApi" module using @optics@:
2323--
2424-- >>> :{
25−-- BSL.putStrLn $ encode $ (mempty :: Swagger)
26−-- & #components % #schemas .~ [ ("User", mempty & #type ?~ SwaggerString) ]
25+-- BSL.putStrLn $ encode $ (mempty :: OpenApi)
26+-- & #components % #schemas .~ [ ("User", mempty & #type ?~ OpenApiString) ]
2727-- & #paths .~
2828-- [ ("/user", mempty & #get ?~ (mempty
2929-- & at 200 ?~ ("OK" & #_Inline % #content % at "application/json" ?~ (mempty & #schema ?~ Ref (Reference "User")))
@@ -40,7 +40,7 @@
4040-- {"description":"No content"}
4141-- >>> :{
4242-- BSL.putStrLn $ encode $ (mempty :: Schema)
43−-- & #type ?~ SwaggerBoolean
43+-- & #type ?~ OpenApiBoolean
4444-- & #description ?~ "To be or not to be"
4545-- :}
4646-- {"type":"boolean","description":"To be or not to be"}
@@ -65,7 +65,7 @@ import Optics.TH
6565
6666-- Lenses
6767
68−makeFieldLabels ''Swagger
68+makeFieldLabels ''OpenApi
6969makeFieldLabels ''Components
7070makeFieldLabels ''Server
7171makeFieldLabels ''ServerVariable
@@ -103,30 +103,30 @@ makeFieldLabels ''Link
103103makePrismLabels ''SecuritySchemeType
104104makePrismLabels ''Referenced
105105
106−-- SwaggerItems prisms
106+-- OpenApiItems prisms
107107
108108instance
109109 ( a ~ [Referenced Schema]
110110 , b ~ [Referenced Schema]
111− ) => LabelOptic "_SwaggerItemsArray"
111+ ) => LabelOptic "_OpenApiItemsArray"
112112 A_Review
113− SwaggerItems
114− SwaggerItems
113+ OpenApiItems
114+ OpenApiItems
115115 a
116116 b where
117− labelOptic = unto (\x -> SwaggerItemsArray x)
117+ labelOptic = unto (\x -> OpenApiItemsArray x)
118118 {-# INLINE labelOptic #-}
119119
120120instance
121121 ( a ~ Referenced Schema
122122 , b ~ Referenced Schema
123− ) => LabelOptic "_SwaggerItemsObject"
123+ ) => LabelOptic "_OpenApiItemsObject"
124124 A_Review
125− SwaggerItems
126− SwaggerItems
125+ OpenApiItems
126+ OpenApiItems
127127 a
128128 b where
129− labelOptic = unto (\x -> SwaggerItemsObject x)
129+ labelOptic = unto (\x -> OpenApiItemsObject x)
130130 {-# INLINE labelOptic #-}
131131
132132-- =============================================================
@@ -155,8 +155,8 @@ instance At Operation where
155155-- #type
156156
157157instance
158− ( a ~ Maybe SwaggerType
159− , b ~ Maybe SwaggerType
158+ ( a ~ Maybe OpenApiType
159+ , b ~ Maybe OpenApiType
160160 ) => LabelOptic "type" A_Lens NamedSchema NamedSchema a b where
161161 labelOptic = #schema % #type
162162 {-# INLINE labelOptic #-}
@@ -180,8 +180,8 @@ instance
180180-- #items
181181
182182instance
183− ( a ~ Maybe SwaggerItems
184− , b ~ Maybe SwaggerItems
183+ ( a ~ Maybe OpenApiItems
184+ , b ~ Maybe OpenApiItems
185185 ) => LabelOptic "items" A_Lens NamedSchema NamedSchema a b where
186186 labelOptic = #schema % #items
187187 {-# INLINE labelOptic #-}
src/Data/OpenApi/Schema/Generator.hs+9−9
@@ -39,25 +39,25 @@ schemaGen defns schema =
3939 [ inferredType ] -> schemaGen defns (schema & type_ ?~ inferredType)
4040 -- Gen is not MonadFail
4141 _ -> error "unable to infer schema type"
42− Just SwaggerBoolean -> Bool <$> elements [True, False]
43− Just SwaggerNull -> pure Null
44− Just SwaggerNumber
42+ Just OpenApiBoolean -> Bool <$> elements [True, False]
43+ Just OpenApiNull -> pure Null
44+ Just OpenApiNumber
4545 | Just min <- schema ^. minimum_
4646 , Just max <- schema ^. maximum_ ->
4747 Number . fromFloatDigits <$>
4848 choose (toRealFloat min, toRealFloat max :: Double)
4949 | otherwise -> Number .fromFloatDigits <$> (arbitrary :: Gen Double)
50− Just SwaggerInteger
50+ Just OpenApiInteger
5151 | Just min <- schema ^. minimum_
5252 , Just max <- schema ^. maximum_ ->
5353 Number . fromInteger <$>
5454 choose (truncate min, truncate max)
5555 | otherwise -> Number . fromInteger <$> arbitrary
56− Just SwaggerArray
56+ Just OpenApiArray
5757 | Just 0 <- schema ^. maxLength -> pure $ Array V.empty
5858 | Just items <- schema ^. items ->
5959 case items of
60− SwaggerItemsObject ref -> do
60+ OpenApiItemsObject ref -> do
6161 size <- getSize
6262 let itemSchema = dereference defns ref
6363 minLength' = fromMaybe 0 $ fromInteger <$> schema ^. minItems
@@ -65,17 +65,17 @@ schemaGen defns schema =
6565 arrayLength <- choose (minLength', max minLength' maxLength')
6666 generatedArray <- vectorOf arrayLength $ schemaGen defns itemSchema
6767 return . Array $ V.fromList generatedArray
68− SwaggerItemsArray refs ->
68+ OpenApiItemsArray refs ->
6969 let itemGens = schemaGen defns . dereference defns <$> refs
7070 in fmap (Array . V.fromList) $ sequence itemGens
71− Just SwaggerString -> do
71+ Just OpenApiString -> do
7272 size <- getSize
7373 let minLength' = fromMaybe 0 $ fromInteger <$> schema ^. minLength
7474 let maxLength' = fromMaybe size $ fromInteger <$> schema ^. maxLength
7575 length <- choose (minLength', max minLength' maxLength')
7676 str <- vectorOf length arbitrary
7777 return . String $ T.pack str
78− Just SwaggerObject -> do
78+ Just OpenApiObject -> do
7979 size <- getSize
8080 let props = dereference defns <$> schema ^. properties
8181 reqKeys = S.fromList $ schema ^. required
src/Data/OpenApi/Schema/Validation.hs+3−3
@@ -71,11 +71,11 @@ import Data.OpenApi.Internal.Schema.Validation
7171-- generally fails for @null@ JSON:
7272--
7373-- >>> validateToJSON (Nothing :: Maybe String)
74−-- ["expected JSON value of type SwaggerString"]
74+-- ["expected JSON value of type OpenApiString"]
7575-- >>> validateToJSON ([Just "hello", Nothing] :: [Maybe String])
76−-- ["expected JSON value of type SwaggerString"]
76+-- ["expected JSON value of type OpenApiString"]
7777-- >>> validateToJSON (123, Nothing :: Maybe String)
78−-- ["expected JSON value of type SwaggerString"]
78+-- ["expected JSON value of type OpenApiString"]
7979--
8080-- However, when @'Maybe' a@ is a type of a record field,
8181-- validation takes @'required'@ property of the @'Schema'@
test/Data/OpenApi/Schema/GeneratorSpec.hs+4−4
@@ -103,7 +103,7 @@ instance FromJSON WrongType where
103103instance ToSchema WrongType where
104104 declareNamedSchema _ = return . NamedSchema (Just "WrongType") $
105105 mempty
106− & type_ ?~ SwaggerObject
106+ & type_ ?~ OpenApiObject
107107
108108
109109data MissingRequired = MissingRequired
@@ -123,7 +123,7 @@ instance ToSchema MissingRequired where
123123 boolSchema <- declareSchemaRef (Proxy :: Proxy Bool)
124124 return . NamedSchema (Just "MissingRequired") $
125125 mempty
126− & type_ ?~ SwaggerObject
126+ & type_ ?~ OpenApiObject
127127 & properties .~ [("propA", stringSchema)
128128 ,("propB", boolSchema)
129129 ]
@@ -145,7 +145,7 @@ instance ToSchema MissingProperty where
145145 stringSchema <- declareSchemaRef (Proxy :: Proxy String)
146146 return . NamedSchema (Just "MissingProperty") $
147147 mempty
148− & type_ ?~ SwaggerObject
148+ & type_ ?~ OpenApiObject
149149 & properties .~ [("propC", stringSchema)]
150150 & required .~ ["propC"]
151151
@@ -163,6 +163,6 @@ instance ToSchema WrongPropType where
163163 boolSchema <- declareSchemaRef (Proxy :: Proxy Bool)
164164 return . NamedSchema (Just "WrongPropType") $
165165 mempty
166− & type_ ?~ SwaggerObject
166+ & type_ ?~ OpenApiObject
167167 & properties .~ [("propE", boolSchema)]
168168 & required .~ ["propE"]
test/Data/OpenApi/Schema/ValidationSpec.hs+1−1
@@ -277,7 +277,7 @@ instance ToJSON FreeForm where
277277
278278instance ToSchema FreeForm where
279279 declareNamedSchema _ = pure $ NamedSchema (Just $ T.pack "FreeForm") $ mempty
280− & type_ ?~ SwaggerObject
280+ & type_ ?~ OpenApiObject
281281 & additionalProperties ?~ AdditionalPropertiesAllowed True
282282
283283instance Arbitrary FreeForm where
test/Data/OpenApiSpec.hs+32−32
@@ -42,9 +42,9 @@ spec = do
4242 context "Todo Example" $ swaggerExample <=> swaggerExampleJSON
4343 context "PetStore Example" $ do
4444 it "decodes successfully" $ do
45− fromJSON petstoreExampleJSON `shouldSatisfy` (\x -> case x of Success (_ :: Swagger) -> True; _ -> False)
45+ fromJSON petstoreExampleJSON `shouldSatisfy` (\x -> case x of Success (_ :: OpenApi) -> True; _ -> False)
4646 it "roundtrips: fmap toJSON . fromJSON" $ do
47− (toJSON :: Swagger -> Value) <$> fromJSON petstoreExampleJSON `shouldBe` Success petstoreExampleJSON
47+ (toJSON :: OpenApi -> Value) <$> fromJSON petstoreExampleJSON `shouldBe` Success petstoreExampleJSON
4848
4949main :: IO ()
5050main = hspec spec
@@ -132,15 +132,15 @@ operationExample = mempty
132132 & description ?~ "ID of pet that needs to be updated"
133133 & required ?~ True
134134 & in_ .~ ParamPath
135− & schema ?~ Inline (mempty & type_ ?~ SwaggerString))]
135+ & schema ?~ Inline (mempty & type_ ?~ OpenApiString))]
136136 & requestBody ?~ Inline (
137137 mempty & content . at "application/x-www-form-urlencoded" ?~ (mempty & schema ?~ (Inline (mempty
138138 & properties . at "petId" ?~ Inline (mempty
139139 & description ?~ "Updated name of the pet"
140− & type_ ?~ SwaggerString)
140+ & type_ ?~ OpenApiString)
141141 & properties . at "status" ?~ Inline (mempty
142142 & description ?~ "Updated status of the pet"
143− & type_ ?~ SwaggerString)))))
143+ & type_ ?~ OpenApiString)))))
144144 & at 200 ?~ "Pet updated."
145145 & at 405 ?~ "Invalid input"
146146 & security .~ [SecurityRequirement [("petstore_auth", ["write:pets", "read:pets"])]]
@@ -208,7 +208,7 @@ operationExampleJSON = [aesonQQ|
208208
209209schemaPrimitiveExample :: Schema
210210schemaPrimitiveExample = mempty
211− & type_ ?~ SwaggerString
211+ & type_ ?~ OpenApiString
212212 & format ?~ "email"
213213
214214schemaPrimitiveExampleJSON :: Value
@@ -221,14 +221,14 @@ schemaPrimitiveExampleJSON = [aesonQQ|
221221
222222schemaSimpleModelExample :: Schema
223223schemaSimpleModelExample = mempty
224− & type_ ?~ SwaggerObject
224+ & type_ ?~ OpenApiObject
225225 & required .~ [ "name" ]
226226 & properties .~
227− [ ("name", Inline (mempty & type_ ?~ SwaggerString))
227+ [ ("name", Inline (mempty & type_ ?~ OpenApiString))
228228 , ("address", Ref (Reference "Address"))
229229 , ("age", Inline $ mempty
230230 & minimum_ ?~ 0
231− & type_ ?~ SwaggerInteger
231+ & type_ ?~ OpenApiInteger
232232 & format ?~ "int32" ) ]
233233
234234schemaSimpleModelExampleJSON :: Value
@@ -253,8 +253,8 @@ schemaSimpleModelExampleJSON = [aesonQQ|
253253
254254schemaModelDictExample :: Schema
255255schemaModelDictExample = mempty
256− & type_ ?~ SwaggerObject
257− & additionalProperties ?~ AdditionalPropertiesSchema (Inline (mempty & type_ ?~ SwaggerString))
256+ & type_ ?~ OpenApiObject
257+ & additionalProperties ?~ AdditionalPropertiesSchema (Inline (mempty & type_ ?~ OpenApiString))
258258
259259schemaModelDictExampleJSON :: Value
260260schemaModelDictExampleJSON = [aesonQQ|
@@ -268,7 +268,7 @@ schemaModelDictExampleJSON = [aesonQQ|
268268
269269schemaAdditionalExample :: Schema
270270schemaAdditionalExample = mempty
271− & type_ ?~ SwaggerObject
271+ & type_ ?~ OpenApiObject
272272 & additionalProperties ?~ AdditionalPropertiesAllowed True
273273
274274schemaAdditionalExampleJSON :: Value
@@ -281,13 +281,13 @@ schemaAdditionalExampleJSON = [aesonQQ|
281281
282282schemaWithExampleExample :: Schema
283283schemaWithExampleExample = mempty
284− & type_ ?~ SwaggerObject
284+ & type_ ?~ OpenApiObject
285285 & properties .~
286286 [ ("id", Inline $ mempty
287− & type_ ?~ SwaggerInteger
287+ & type_ ?~ OpenApiInteger
288288 & format ?~ "int64" )
289289 , ("name", Inline $ mempty
290− & type_ ?~ SwaggerString) ]
290+ & type_ ?~ OpenApiString) ]
291291 & required .~ [ "name" ]
292292 & example ?~ [aesonQQ|
293293 {
@@ -326,19 +326,19 @@ schemaWithExampleExampleJSON = [aesonQQ|
326326definitionsExample :: HashMap Text Schema
327327definitionsExample =
328328 [ ("Category", mempty
329− & type_ ?~ SwaggerObject
329+ & type_ ?~ OpenApiObject
330330 & properties .~
331331 [ ("id", Inline $ mempty
332− & type_ ?~ SwaggerInteger
332+ & type_ ?~ OpenApiInteger
333333 & format ?~ "int64")
334− , ("name", Inline (mempty & type_ ?~ SwaggerString)) ] )
334+ , ("name", Inline (mempty & type_ ?~ OpenApiString)) ] )
335335 , ("Tag", mempty
336− & type_ ?~ SwaggerObject
336+ & type_ ?~ OpenApiObject
337337 & properties .~
338338 [ ("id", Inline $ mempty
339− & type_ ?~ SwaggerInteger
339+ & type_ ?~ OpenApiInteger
340340 & format ?~ "int64")
341− , ("name", Inline (mempty & type_ ?~ SwaggerString)) ] ) ]
341+ , ("name", Inline (mempty & type_ ?~ OpenApiString)) ] ) ]
342342
343343definitionsExampleJSON :: Value
344344definitionsExampleJSON = [aesonQQ|
@@ -382,7 +382,7 @@ paramsDefinitionExample =
382382 & required ?~ True
383383 & in_ .~ ParamQuery
384384 & schema ?~ Inline (mempty
385− & type_ ?~ SwaggerInteger
385+ & type_ ?~ OpenApiInteger
386386 & format ?~ "int32" ))
387387 , ("limitParam", mempty
388388 & name .~ "limit"
@@ -390,7 +390,7 @@ paramsDefinitionExample =
390390 & required ?~ True
391391 & in_ .~ ParamQuery
392392 & schema ?~ Inline (mempty
393− & type_ ?~ SwaggerInteger
393+ & type_ ?~ OpenApiInteger
394394 & format ?~ "int32" )) ]
395395
396396paramsDefinitionExampleJSON :: Value
@@ -531,7 +531,7 @@ oAuth2SecurityDefinitionsExampleJSON = [aesonQQ|
531531-- Swagger object
532532-- =======================================================================
533533
534−emptyPathsFieldExample :: Swagger
534+emptyPathsFieldExample :: OpenApi
535535emptyPathsFieldExample = mempty
536536
537537emptyPathsFieldExampleJSON :: Value
@@ -544,7 +544,7 @@ emptyPathsFieldExampleJSON = [aesonQQ|
544544}
545545|]
546546
547−swaggerExample :: Swagger
547+swaggerExample :: OpenApi
548548swaggerExample = mempty
549549 -- & basePath ?~ "/"
550550 -- & schemes ?~ [Http]
@@ -559,7 +559,7 @@ swaggerExample = mempty
559559 & description .~ "OK"
560560 & content . at "application/json" ?~ (mempty
561561 & schema ?~ Inline (mempty
562− & type_ ?~ SwaggerObject
562+ & type_ ?~ OpenApiObject
563563 & example ?~ [aesonQQ|
564564 {
565565 "created": 100,
@@ -568,9 +568,9 @@ swaggerExample = mempty
568568 & description ?~ "This is some real Todo right here"
569569 & properties .~
570570 [ ("created", Inline $ mempty
571− & type_ ?~ SwaggerInteger
571+ & type_ ?~ OpenApiInteger
572572 & format ?~ "int32")
573− , ("description", Inline (mempty & type_ ?~ SwaggerString))])))
573+ , ("description", Inline (mempty & type_ ?~ OpenApiString))])))
574574 & parameters .~
575575 [ Inline $ mempty
576576 & required ?~ True
@@ -578,7 +578,7 @@ swaggerExample = mempty
578578 & description ?~ "TodoId param"
579579 & in_ .~ ParamPath
580580 & schema ?~ Inline (mempty
581− & type_ ?~ SwaggerString ) ]
581+ & type_ ?~ OpenApiString ) ]
582582 & tags .~ InsOrdHS.fromList [ "todo" ] ))
583583
584584swaggerExampleJSON :: Value
@@ -917,14 +917,14 @@ petstoreExampleJSON = [aesonQQ|
917917
918918compositionSchemaExample :: Schema
919919compositionSchemaExample = mempty
920− & type_ ?~ SwaggerObject
920+ & type_ ?~ OpenApiObject
921921 & Data.OpenApi.allOf ?~ [
922922 Ref (Reference "Other")
923923 , Inline (mempty
924− & type_ ?~ SwaggerObject
924+ & type_ ?~ OpenApiObject
925925 & properties .~
926926 [ ("greet", Inline $ mempty
927− & type_ ?~ SwaggerString) ])
927+ & type_ ?~ OpenApiString) ])
928928 ]
929929
930930compositionSchemaExampleJSON :: Value