DefaultGenerator: ignore only form param schemas#74
DefaultGenerator: ignore only form param schemas#74jmini merged 7 commits intoOpenAPITools:masterfrom
Conversation
|
I tested this one with and ran --- a/samples/client/petstore/ruby/README.md
+++ b/samples/client/petstore/ruby/README.md
@@ -109,38 +109,11 @@ Class | Method | HTTP request | Description
## Documentation for Models
- - [Petstore::AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md)
- - [Petstore::Animal](docs/Animal.md)
- - [Petstore::AnimalFarm](docs/AnimalFarm.md)
- [Petstore::ApiResponse](docs/ApiResponse.md)
- - [Petstore::ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md)
- - [Petstore::ArrayOfNumberOnly](docs/ArrayOfNumberOnly.md)
- - [Petstore::ArrayTest](docs/ArrayTest.md)
- - [Petstore::Capitalization](docs/Capitalization.md)
- - [Petstore::Cat](docs/Cat.md)
- - [Petstore::Category](docs/Category.md)
- - [Petstore::ClassModel](docs/ClassModel.md)
- [Petstore::Client](docs/Client.md)
- - [Petstore::Dog](docs/Dog.md)
- - [Petstore::EnumArrays](docs/EnumArrays.md)
- - [Petstore::EnumClass](docs/EnumClass.md)
- - [Petstore::EnumTest](docs/EnumTest.md)
- - [Petstore::FormatTest](docs/FormatTest.md)
- - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md)
- - [Petstore::List](docs/List.md)
- - [Petstore::MapTest](docs/MapTest.md)
- - [Petstore::MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md)
- - [Petstore::Model200Response](docs/Model200Response.md)
- - [Petstore::ModelReturn](docs/ModelReturn.md)
- - [Petstore::Name](docs/Name.md)
- - [Petstore::NumberOnly](docs/NumberOnly.md)
- [Petstore::Order](docs/Order.md)
- [Petstore::OuterComposite](docs/OuterComposite.md)
- - [Petstore::OuterEnum](docs/OuterEnum.md)
- [Petstore::Pet](docs/Pet.md)
- - [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md)
- - [Petstore::SpecialModelName](docs/SpecialModelName.md)
- - [Petstore::Tag](docs/Tag.md)
- [Petstore::User](docs/User.md)A lot of models are no longer auto-generated. |
|
Ok... I did not check in detail, but I guess that those model definitions are not used in the petstore-with-fake-endpoints-models-for-testing.yaml I still do not get the precise requirements are for this The point, if you work with the OAS2 proposed in #50, some Model classes are missing (code is not compiling) so this is a regression compared to Swagger-Codegen 2.x. @etherealjoy has also reported a regression with "aspnetcore" generator. We need to do something. |
|
Sure let me take another look at that problem tomorrow and see if I can come up with a better solution. There's a workaround to solve that problem by removing "application/x-www-form-urlencoded" |
|
Something to consider as well, some folks (like me) generate models from models-only specs. Will this break that use case? If so, I think we'll need to make it conditional. |
Yes, I'm aware of such use case. |
|
@wing328: let summarize it that way: == The current implementation does: == I think what the correct implementation should do is: If you confirm this, I can rework the PR based on this requirement. |
|
As discussed you've pointed out a use case that's not covered by my current implementation, please feel free to come up with a better solution. |
|
Input @wing328 :
I think that the |
|
@wing328 I have tested it with |
| unusedSchemas.remove(getSimpleRef(mediaType.getSchema().get$ref())); | ||
| } | ||
| } | ||
| */ |
There was a problem hiding this comment.
@jmini what about removing this commented code block?
| } | ||
| */ | ||
|
|
||
| private static void visitOpenAPI(OpenAPI openAPI, OpenAPISchemaVisitor visitor) { |
There was a problem hiding this comment.
I would suggest adding a 1-liner explaining what this function does.
|
@wing328 nice catch, I have removed the dead code and add a javadoc on the private method. Thank you a lot for this review. |
Fix for #50.
This looks for all used schema to compute the unused one.