New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixes for issue #799 returning ref as internal #801
Conversation
This does not solve my problem. My use case is the conversation to an OpenAPI v3 model. Here is my test procedure:
Then in the Main class:
Using v1beta3.json as input spec for With this dependencies:
Still the same output as the one described in #799. I get:
Instead of:
which was the case with |
This PR tries to fix conversation of from I have executed your test: In this test you have I see 2 semantic errors:
So I guess that the v1.2 to v2.0 feature is also not working in all cases. PS: Thank you a lot for looking into this issue! |
|
||
Swagger swagger = converter.read("src/test/resources/specs/v1_2/issue799.json"); | ||
Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.Binding"); | ||
Json.prettyPrint(swagger); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add following assertions before the Json.prettyPrint(swagger)
line:
Parameter bodyParameter = swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/bindings").getPost().getParameters().get(1);
Assert.assertEquals( bodyParameter.getName(), "body");
Assert.assertTrue( bodyParameter instanceof BodyParameter);
Assert.assertEquals( ((BodyParameter)bodyParameter).getSchema().getReference(), "#/definitions/v1beta3.Binding");
Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses/{name}").getGet().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.ComponentStatus");
Assert.assertEquals( swagger.getPaths().get("/api/v1beta3/namespaces/{namespaces}/componentstatuses").getGet().getResponses().get("200").getResponseSchema().getReference(), "#/definitions/v1beta3.ComponentStatusList");
Property conditionsProperty = swagger.getDefinitions().get("v1beta3.ComponentStatus").getProperties().get("conditions");
Assert.assertTrue( conditionsProperty instanceof ArrayProperty);
Property items = ((ArrayProperty)conditionsProperty).getItems();
Assert.assertTrue( items instanceof RefProperty);
Assert.assertEquals( ((RefProperty)items).get$ref(), "#/definitions/v1beta3.ObjectReference");
Property metadataProperty = swagger.getDefinitions().get("v1beta3.ComponentStatus").getProperties().get("metadata");
Assert.assertTrue( metadataProperty instanceof RefProperty);
Assert.assertEquals( ((RefProperty)metadataProperty).get$ref(), "#/definitions/v1beta3.ObjectMeta");
This looks good to me, you could extend the unit test as I have suggested. With this PR the regression introduced with |
fixes for issue #799 returning ref as internal