git.iko.soy/typeable/swagger2
on master help sign in
Add minItems and maxItems for tuples (close #63)
179ab5eNickolay Kudasov
src/Data/Swagger/Internal/Schema.hs+2
@@ -685,6 +685,8 @@ withFieldSchema opts _ isRequiredField schema = do
685 then schema
685 then schema
686 & type_ .~ SwaggerArray
686 & type_ .~ SwaggerArray
687 & items %~ appendItem ref
687 & items %~ appendItem ref
688+ & maxItems %~ Just . maybe 1 (+1) -- increment maxItems
689+ & minItems %~ Just . maybe 1 (+1) -- increment minItems
688 else schema
690 else schema
689 & type_ .~ SwaggerObject
691 & type_ .~ SwaggerObject
690 & properties . at fname ?~ ref
692 & properties . at fname ?~ ref
test/Data/Swagger/SchemaSpec.hs+3−1
@@ -146,7 +146,9 @@ ispairSchemaJSON = [aesonQQ|
146 [
146 [
147 { "type": "integer" },
147 { "type": "integer" },
148 { "type": "string" }
148 { "type": "string" }
149− ]
149+ ],
150+ "minItems": 2,
151+ "maxItems": 2
150}
152}
151|]
153|]
152
154