[BUG] Generation of test cases are failing for spring.
Created by: jskhedkarl
OpenAPI generator is not generating Integration test cases for spring API's Using the following generator to generate spring based code from openAPI specification. <openapi-generator-maven-plugin.version>4.0.2</openapi-generator-maven-plugin.version> swagger spec https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v3.0/petstore.yaml
However, older swagger-codegen is able to generate integration test cases for API's.
1#Code generation using openapi-generator 4.0.2 rm -rf Tester/* && openapi-generator generate -i petstore.yaml -g spring --library spring-mvc -o Tester/ skhedkar@Thanos:~/sandbox/trunk/jhipster$ tree Tester/ Tester/ ├── pom.xml ├── README.md └── src └── main ├── java │ └── org │ └── openapitools │ ├── api │ │ ├── ApiUtil.java │ │ ├── PetsApiController.java │ │ └── PetsApi.java │ ├── configuration │ │ ├── HomeController.java │ │ ├── OpenAPIDocumentationConfig.java │ │ ├── OpenAPIUiConfiguration.java │ │ ├── RFC3339DateFormat.java │ │ ├── WebApplication.java │ │ └── WebMvcConfiguration.java │ └── model │ ├── Error.java │ └── Pet.java └── resources └── application.properties
9 directories, 14 files
2#Code generation using swagger-codegen-cli 3.0.9 rm -rf Tester/* && java -jar swagger-codegen-cli-3.0.9-20190627.154813-43.jar generate -i petstore.yaml -l spring --library spring-mvc -o Tester/
skhedkar@Thanos:~/sandbox/trunk/swagger$ tree Tester/ Tester/ ├── pom.xml ├── README.md └── src ├── main │ ├── java │ │ └── io │ │ └── swagger │ │ ├── api │ │ │ ├── ApiException.java │ │ │ ├── ApiOriginFilter.java │ │ │ ├── ApiResponseMessage.java │ │ │ ├── NotFoundException.java │ │ │ ├── PetsApiController.java │ │ │ └── PetsApi.java │ │ ├── configuration │ │ │ ├── CustomInstantDeserializer.java │ │ │ ├── RFC3339DateFormat.java │ │ │ ├── SwaggerDocumentationConfig.java │ │ │ ├── SwaggerUiConfiguration.java │ │ │ ├── WebApplication.java │ │ │ └── WebMvcConfiguration.java │ │ └── model │ │ ├── Error.java │ │ ├── Pet.java │ │ └── Pets.java │ └── resources │ └── swagger.properties └── test └── java └── io └── swagger └── api └── PetsApiControllerIT.java
Major difference between openapi-generator and swagger-codegen-cli is that template file api_test.mustache is missing in former.
I don't know if it is a bug or test case generation is not supported for spring in openapi-generator.