@@ -38,10 +38,12 @@ x <=> json = do
3838
3939spec :: Spec
4040spec = do
41− describe "Operation Object" $ operationExample <~> operationExampleJSON
4241 describe "License Object" $ licenseExample <=> licenseExampleJSON
4342 describe "Contact Object" $ contactExample <=> contactExampleJSON
4443 describe "Info Object" $ infoExample <=> infoExampleJSON
44+ describe "Operation Object" $ operationExample <~> operationExampleJSON
45+ describe "Schema Object" $ do
46+ context "Primitive Sample" $ schemaPrimitiveExample <~> schemaPrimitiveExampleJSON
4547
4648main :: IO ()
4749main = hspec spec
@@ -183,21 +185,6 @@ operationExample = SwaggerOperation
183185 , swaggerParameterOtherSchemaCommon = emptySchemaCommon
184186 }
185187
186− emptySchemaCommon = SwaggerSchemaCommon
187− { swaggerSchemaDefault = Nothing
188− , swaggerSchemaMaximum = Nothing
189− , swaggerSchemaExclusiveMaximum = Nothing
190− , swaggerSchemaMinimum = Nothing
191− , swaggerSchemaExclusiveMinimum = Nothing
192− , swaggerSchemaMaxLength = Nothing
193− , swaggerSchemaMinLength = Nothing
194− , swaggerSchemaPattern = Nothing
195− , swaggerSchemaMaxItems = Nothing
196− , swaggerSchemaMinItems = Nothing
197− , swaggerSchemaUniqueItems = Nothing
198− , swaggerSchemaEnum = Nothing
199− , swaggerSchemaMultipleOf = Nothing }
200−
201188operationExampleJSON :: Value
202189operationExampleJSON = [aesonQQ|
203190{
@@ -255,3 +242,52 @@ operationExampleJSON = [aesonQQ|
255242 ]
256243}
257244|]
245+
246+-- =======================================================================
247+-- Schema object
248+-- =======================================================================
249+
250+schemaPrimitiveExample :: SwaggerSchema
251+schemaPrimitiveExample = SwaggerSchema
252+ { swaggerSchemaType = SwaggerSchemaString
253+ , swaggerSchemaFormat = Just "email"
254+ , swaggerSchemaTitle = Nothing
255+ , swaggerSchemaDescription = Nothing
256+ , swaggerSchemaRequired = Nothing
257+ , swaggerSchemaItems = Nothing
258+ , swaggerSchemaAllOf = Nothing
259+ , swaggerSchemaProperties = mempty
260+ , swaggerSchemaAdditionalProperties = Nothing
261+ , swaggerSchemaDiscriminator = Nothing
262+ , swaggerSchemaReadOnly = Nothing
263+ , swaggerSchemaXml = Nothing
264+ , swaggerSchemaExternalDocs = Nothing
265+ , swaggerSchemaExample = Nothing
266+ , swaggerSchemaMaxProperties = Nothing
267+ , swaggerSchemaMinProperties = Nothing
268+ , swaggerSchemaCommon = emptySchemaCommon }
269+
270+schemaPrimitiveExampleJSON :: Value
271+schemaPrimitiveExampleJSON = [aesonQQ|
272+{
273+ "type": "string",
274+ "format": "email"
275+}
276+|]
277+
278+emptySchemaCommon :: SwaggerSchemaCommon
279+emptySchemaCommon = SwaggerSchemaCommon
280+ { swaggerSchemaDefault = Nothing
281+ , swaggerSchemaMaximum = Nothing
282+ , swaggerSchemaExclusiveMaximum = Nothing
283+ , swaggerSchemaMinimum = Nothing
284+ , swaggerSchemaExclusiveMinimum = Nothing
285+ , swaggerSchemaMaxLength = Nothing
286+ , swaggerSchemaMinLength = Nothing
287+ , swaggerSchemaPattern = Nothing
288+ , swaggerSchemaMaxItems = Nothing
289+ , swaggerSchemaMinItems = Nothing
290+ , swaggerSchemaUniqueItems = Nothing
291+ , swaggerSchemaEnum = Nothing
292+ , swaggerSchemaMultipleOf = Nothing }
293+