Some property missing from V2 Parameter deserializer (e.g. multipleOf)
Here's an exhaustive list of the unsupported properties:
- exclusiveMaximum
- exclusiveMinimum
- maxItems
- minItems
- uniqueItems
- multipleOf
Reference: https://swagger.io/specification/v2/#parameterObject
Are there any plans to support these properties?
Are there any plans to support these properties?
@kylehild I can't speak on behalf of the maintainers, and I don't know if it's an option for you - but it was easy for us to migrate to V3 and worth the effort.
minItems and maxItems are not properly working for parameter deserializing. They work only if under the items node, which is not proper OASv2. Serializing works fine.
var testString = @"
{
""swagger"": ""2.0"",
""parameters"": {
""param0"": {
""type"": ""array"",
""items"": {
""type"": ""integer""
},
""maxItems"": 4,
""minItems"": 4
}
}
}
".Trim();
var testDoc = new OpenApiStringReader().Read(testString.ToString(), out var diag);
Console.Out.WriteLine(testDoc.Components.Parameters["param0"].Schema.MaxItems); // Expected: 4 Actual: null
Console.Out.WriteLine(testDoc.Components.Parameters["param0"].Schema.MinItems); // Expected: 4 Actual: null
testString = @"
{
""swagger"": ""2.0"",
""parameters"": {
""param0"": {
""type"": ""array"",
""items"": {
""type"": ""integer"",
""maxItems"": 4,
""minItems"": 4
}
}
}
}
".Trim();
testDoc = new OpenApiStringReader().Read(testString.ToString(), out diag);
Console.Out.WriteLine(testDoc.Components.Parameters["param0"].Schema.Items.MaxItems); // Expected: 4 Actual: 4 but not proper OASv2
Console.Out.WriteLine(testDoc.Components.Parameters["param0"].Schema.Items.MinItems); // Expected: 4 Actual: 4 but not proper OASv2
testDoc = new OpenApiDocument
{
Components = new OpenApiComponents
{
Parameters =
{
["param0"] = new OpenApiParameter
{
Schema = new OpenApiSchema
{
Type = "array",
Items = new OpenApiSchema
{
Type = "integer"
},
MaxItems = 4,
MinItems = 4,
}
}
}
}
};
Console.Out.WriteLine(JObject.Parse(testDoc.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0))["parameters"]["param0"]["maxItems"]); // Expected: 4 Actual: 4
Console.Out.WriteLine(JObject.Parse(testDoc.SerializeAsJson(OpenApiSpecVersion.OpenApi2_0))["parameters"]["param0"]["minItems"]); // Expected: 4 Actual: 4
}