Add minItems and maxItems for tuples (close #63)
commit179ab5ed1718af862b775fc235a8a384b525b55e
authorNickolay Kudasov <nickolay.kudasov@gmail.com>
dateSat 18 Feb 2017, 11:01 (10 years ago)
parent229b4df
src/Data/Swagger/Internal/Schema.hs+2
@@ -685,6 +685,8 @@ withFieldSchema opts _ isRequiredField schema = do
685685 then schema
686686 & type_ .~ SwaggerArray
687687 & items %~ appendItem ref
688+ & maxItems %~ Just . maybe 1 (+1) -- increment maxItems
689+ & minItems %~ Just . maybe 1 (+1) -- increment minItems
688690 else schema
689691 & type_ .~ SwaggerObject
690692 & properties . at fname ?~ ref
test/Data/Swagger/SchemaSpec.hs+3−1
@@ -146,7 +146,9 @@ ispairSchemaJSON = [aesonQQ|
146146 [
147147 { "type": "integer" },
148148 { "type": "string" }
149− ]
149+ ],
150+ "minItems": 2,
151+ "maxItems": 2
150152}
151153|]
152154