@@ -38,18 +38,18 @@ data Swagger = Swagger
3838 , swaggerPaths :: SwaggerPaths
3939
4040 -- | An object to hold data types produced and consumed by operations.
41− , swaggerDefinitions :: [SwaggerDefinition]
41+ , swaggerDefinitions :: HashMap Text SwaggerSchema
4242
4343 -- | An object to hold parameters that can be used across operations.
4444 -- This property does not define global parameters for all operations.
45− , swaggerParameters :: [SwaggerParamDefinition]
45+ , swaggerParameters :: HashMap Text SwaggerParameter
4646
4747 -- | An object to hold responses that can be used across operations.
4848 -- This property does not define global responses for all operations.
49− , swaggerResponses :: [SwaggerResponseDefinition]
49+ , swaggerResponses :: HashMap Text SwaggerResponse
5050
5151 -- | Security scheme definitions that can be used across the specification.
52− , swaggerSecurityDefinitions :: [SwaggerSecurityDefinition]
52+ , swaggerSecurityDefinitions :: HashMap Text SwaggerSecurityScheme
5353
5454 -- | A declaration of which security schemes are applied for the API as a whole.
5555 -- The list of values describes alternative security schemes that can be used
@@ -559,18 +559,55 @@ data SwaggerHeader = SwaggerHeader
559559data SwaggerExample = SwaggerExample
560560 deriving (Show)
561561
562−data SwaggerDefinition = SwaggerDefinition
562+-- | The location of the API key.
563+data SwaggerApiKeyLocation
564+ = SwaggerApiKeyQuery
565+ | SwaggerApiKeyHeader
563566 deriving (Show)
564567
565−data SwaggerParamDefinition = SwaggerParamDefinition
566− deriving (Show)
568+data SwaggerApiKeyParams = SwaggerApiKeyParams
569+ { -- | The name of the header or query parameter to be used.
570+ swaggerApiKeyName :: Text
571+
572+ -- | The location of the API key.
573+ , swaggerApiKeyIn :: SwaggerApiKeyLocation
574+ } deriving (Show)
567575
568−data SwaggerResponseDefinition = SwaggerResponseDefinition
576+-- | The authorization URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
577+type AuthorizationURL = Text
578+
579+-- | The token URL to be used for OAuth2 flow. This SHOULD be in the form of a URL.
580+type TokenURL = Text
581+
582+data SwaggerOAuth2Flow
583+ = SwaggerOAuth2Implicit AuthorizationURL
584+ | SwaggerOAuth2Password TokenURL
585+ | SwaggerOAuth2Application TokenURL
586+ | SwaggerOAuth2AccessCode AuthorizationURL TokenURL
569587 deriving (Show)
570588
571−data SwaggerSecurityDefinition = SwaggerSecurityDefinition
589+data SwaggerOAuth2Params = SwaggerOAuth2Params
590+ { -- | The flow used by the OAuth2 security scheme.
591+ swaggerOAuth2Flow :: SwaggerOAuth2Flow
592+
593+ -- | The available scopes for the OAuth2 security scheme.
594+ , swaggerOAuth2Scopes :: HashMap Text Text
595+ } deriving (Show)
596+
597+data SwaggerSecuritySchemeType
598+ = SwaggerSecuritySchemeBasic
599+ | SwaggerSecuritySchemeApiKey SwaggerApiKeyParams
600+ | SwaggerSecuritySchemeOAuth2 SwaggerOAuth2Params
572601 deriving (Show)
573602
603+data SwaggerSecurityScheme = SwaggerSecurityScheme
604+ { -- | The type of the security scheme.
605+ swaggerSecuritySchemeType :: SwaggerSecuritySchemeType
606+
607+ -- | A short description for security scheme.
608+ , swaggerSecuritySchemeDescription :: Maybe Text
609+ } deriving (Show)
610+
574611data SwaggerSecurityRequirement = SwaggerSecurityRequirement
575612 deriving (Show)
576613