@@ -1 +1,149 @@
1module Data.Swagger.Internal where
1module Data.Swagger.Internal where
3+import Data.Text (Text)
4+import Network (HostName, PortNumber)
5+import Network.HTTP.Media (MediaType)
7+-- | This is the root document object for the API specification.
9+ { -- | Provides metadata about the API.
10+ -- The metadata can be used by the clients if needed.
11+ swaggerInfo :: SwaggerInfo
13+ -- | The host (name or ip) serving the API. It MAY include a port.
14+ -- If the host is not included, the host serving the documentation is to be used (including the port).
15+ , swaggerHost :: Maybe SwaggerHost
17+ -- | The base path on which the API is served, which is relative to the host.
18+ -- If it is not included, the API is served directly under the host.
19+ -- The value MUST start with a leading slash (/).
20+ , swaggerBasePath :: Maybe FilePath
22+ -- | The transfer protocol of the API.
23+ -- If the schemes is not included, the default scheme to be used is the one used to access the Swagger definition itself.
24+ , swaggerSchemes :: Maybe [SwaggerScheme]
26+ -- | A list of MIME types the APIs can consume.
27+ -- This is global to all APIs but can be overridden on specific API calls.
28+ , swaggerConsumes :: [MediaType]
30+ -- | A list of MIME types the APIs can produce.
31+ -- This is global to all APIs but can be overridden on specific API calls.
32+ , swaggerProduces :: [MediaType]
34+ -- | The available paths and operations for the API.
35+ , swaggerPaths :: SwaggerPaths
37+ -- | An object to hold data types produced and consumed by operations.
38+ , swaggerDefinitions :: [SwaggerDefinition]
40+ -- | An object to hold parameters that can be used across operations.
41+ -- This property does not define global parameters for all operations.
42+ , swaggerParameters :: [SwaggerParamDefinition]
44+ -- | An object to hold responses that can be used across operations.
45+ -- This property does not define global responses for all operations.
46+ , swaggerResponses :: [SwaggerResponseDefinition]
48+ -- | Security scheme definitions that can be used across the specification.
49+ , swaggerSecurityDefinitions :: [SwaggerSecurityDefinition]
51+ -- | A declaration of which security schemes are applied for the API as a whole.
52+ -- The list of values describes alternative security schemes that can be used
53+ -- (that is, there is a logical OR between the security requirements).
54+ -- Individual operations can override this definition.
55+ , swaggerSecurity :: [SwaggerSecurityRequirement]
57+ -- | A list of tags used by the specification with additional metadata.
58+ -- The order of the tags can be used to reflect on their order by the parsing tools.
59+ -- Not all tags that are used by the Operation Object must be declared.
60+ -- The tags that are not declared may be organized randomly or based on the tools' logic.
61+ -- Each tag name in the list MUST be unique.
62+ , swaggerTags :: [SwaggerTag]
64+ -- | Additional external documentation.
65+ , swaggerExternalDocs :: SwaggerExternalDocs
68+-- | The object provides metadata about the API.
69+-- The metadata can be used by the clients if needed,
70+-- and can be presented in the Swagger-UI for convenience.
71+data SwaggerInfo = SwaggerInfo
72+ { -- | The title of the application.
73+ swaggerInfoTitle :: Text
75+ -- | A short description of the application.
76+ -- GFM syntax can be used for rich text representation.
77+ , swaggerInfoDescription :: Maybe Text
79+ -- | The Terms of Service for the API.
80+ , swaggerInfoTermsOfService :: Maybe Text
82+ -- | The contact information for the exposed API.
83+ , swaggerInfoContact :: Maybe SwaggerContact
85+ -- | The license information for the exposed API.
86+ , swaggerInfoLicense :: Maybe SwaggerLicense
88+ -- | Provides the version of the application API
89+ -- (not to be confused with the specification version).
90+ , swaggerInfoVersion :: Text
93+data SwaggerContact = SwaggerContact
96+data SwaggerLicense = SwaggerLicense
99+-- | The host (name or ip) serving the API. It MAY include a port.
100+data SwaggerHost = SwaggerHost
101+ { swaggerHostName :: HostName -- ^ Host name.
102+ , swaggerHostPort :: Maybe PortNumber -- ^ Optional port.
105+-- | The transfer protocol of the API.
113+-- | The available paths and operations for the API.
114+data SwaggerPaths = SwaggerPaths
115+ { -- | Holds the relative paths to the individual endpoints.
116+ -- The path is appended to the @'swaggerBasePath'@ in order to construct the full URL.
117+ swaggerPathsMap :: [SwaggerPath]
119+ -- | Allows extensions to the Swagger Schema.
120+ , swaggerPathsExtensions :: [SwaggerExtension]
123+data SwaggerPath = SwaggerPath
126+data SwaggerExtension = SwaggerExtension
129+data SwaggerDefinition = SwaggerDefinition
132+data SwaggerParamDefinition = SwaggerParamDefinition
135+data SwaggerResponseDefinition = SwaggerResponseDefinition
138+data SwaggerSecurityDefinition = SwaggerSecurityDefinition
141+data SwaggerSecurityRequirement = SwaggerSecurityRequirement
144+data SwaggerTag = SwaggerTag
147+data SwaggerExternalDocs = SwaggerExternalDocs