@@ -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