git.iko.soy/typeable/openapi3
on master help sign in
Allow allOf to accept referenced schemas fix #119
573b816Rodrigo Setti
CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+2.1.4.2
2+-------
3+
4+* `allOf` accepts reference schema (see [#119](https://github.com/GetShopTV/swagger2/issues/119))
5+
12.1.4.1
62.1.4.1
2-------
7-------
3
8
src/Data/Swagger/Internal.hs+1−1
@@ -554,7 +554,7 @@ data Schema = Schema
554 , _schemaDescription :: Maybe Text
554 , _schemaDescription :: Maybe Text
555 , _schemaRequired :: [ParamName]
555 , _schemaRequired :: [ParamName]
556
556
557− , _schemaAllOf :: Maybe [Schema]
557+ , _schemaAllOf :: Maybe [Referenced Schema]
558 , _schemaProperties :: InsOrdHashMap Text (Referenced Schema)
558 , _schemaProperties :: InsOrdHashMap Text (Referenced Schema)
559 , _schemaAdditionalProperties :: Maybe (Referenced Schema)
559 , _schemaAdditionalProperties :: Maybe (Referenced Schema)
560
560
swagger2.cabal+1−1
@@ -1,5 +1,5 @@
1name: swagger2
1name: swagger2
2−version: 2.1.4.1
2+version: 2.1.4.2
3synopsis: Swagger 2.0 data model
3synopsis: Swagger 2.0 data model
4description:
4description:
5 This library is inteded to be used for decoding and encoding Swagger 2.0 API
5 This library is inteded to be used for decoding and encoding Swagger 2.0 API
test/Data/SwaggerSpec.hs+31
@@ -42,6 +42,7 @@ spec = do
42 describe "Parameters Definition Object" $ paramsDefinitionExample <=> paramsDefinitionExampleJSON
42 describe "Parameters Definition Object" $ paramsDefinitionExample <=> paramsDefinitionExampleJSON
43 describe "Responses Definition Object" $ responsesDefinitionExample <=> responsesDefinitionExampleJSON
43 describe "Responses Definition Object" $ responsesDefinitionExample <=> responsesDefinitionExampleJSON
44 describe "Security Definitions Object" $ securityDefinitionsExample <=> securityDefinitionsExampleJSON
44 describe "Security Definitions Object" $ securityDefinitionsExample <=> securityDefinitionsExampleJSON
45+ describe "Composition Schema Example" $ compositionSchemaExample <=> compositionSchemaExampleJSON
45 describe "Swagger Object" $ do
46 describe "Swagger Object" $ do
46 context "Todo Example" $ swaggerExample <=> swaggerExampleJSON
47 context "Todo Example" $ swaggerExample <=> swaggerExampleJSON
47 context "PetStore Example" $
48 context "PetStore Example" $
@@ -1614,3 +1615,33 @@ petstoreExampleJSON = [aesonQQ|
1614 }
1615 }
1615}
1616}
1616|]
1617|]
1618+
1619+compositionSchemaExample :: Schema
1620+compositionSchemaExample = mempty
1621+ & type_ .~ SwaggerObject
1622+ & Data.Swagger.allOf ?~ [
1623+ Ref (Reference "Other")
1624+ , Inline (mempty
1625+ & type_ .~ SwaggerObject
1626+ & properties .~
1627+ [ ("greet", Inline $ mempty
1628+ & type_ .~ SwaggerString) ])
1629+ ]
1630+
1631+compositionSchemaExampleJSON :: Value
1632+compositionSchemaExampleJSON = [aesonQQ|
1633+{
1634+ "type": "object",
1635+ "allOf": [
1636+ {
1637+ "$ref": "#/definitions/Other"
1638+ },
1639+ {
1640+ "type": "object",
1641+ "properties": {
1642+ "greet": { "type": "string" }
1643+ }
1644+ }
1645+ ]
1646+}
1647+|]