You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: 3.0.1
info:
title: OpenAPI Test
description: Test
license:
name: Apache-2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: http://localhost:9999/v2
paths:
/ping:
post:
summary: test
description: test it
operationId: pingOp
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/SomeObj'
required: true
responses:
200:
description: OK
content: {}
components:
schemas:
SomeObj:
type: string
minLength: 1
maxLength: 3
Now I can run this test:
@Test
public void testOas3() {
final OpenAPI openAPI = new OpenAPIParser().readLocation(“../testMinMax3.yaml", null, new ParseOptions()).getOpenAPI();
Schema s = openAPI.getComponents().getSchemas().get("SomeObj");
Assert.assertEquals(s.getMinLength(), Integer.valueOf(1));
Assert.assertEquals(s.getMaxLength(), Integer.valueOf(3));
}
This is fine.
Now when you do the same with OAS2, the min and max are not correctly migrated:
@Test
public void testOas2() {
final OpenAPI openAPI = new OpenAPIParser().readLocation(“../testMinMax2.yaml", null, new ParseOptions()).getOpenAPI();
Schema s = openAPI.getComponents().getSchemas().get("SomeObj");
Assert.assertEquals(s.getMinLength(), Integer.valueOf(1)); //java.lang.AssertionError: expected [1] but found [null]
Assert.assertEquals(s.getMaxLength(), Integer.valueOf(3)); //java.lang.AssertionError: expected [3] but found [null]
}
The text was updated successfully, but these errors were encountered:
jmini
changed the title
OpenAPI v2 converter - minLength and maxLength not migrated
OpenAPI v2 converter - minLength, maxLength and pattern not migrated
May 17, 2018
Consider this OAS3 spec (
testMinMax3.yaml
):Now I can run this test:
This is fine.
Now when you do the same with OAS2, the min and max are not correctly migrated:
With this spec (
testMinMax2.yaml
) :This test is failing:
The text was updated successfully, but these errors were encountered: