... | ... | @@ -43,3 +43,34 @@ To setup the test server locally, please run |
|
|
and add the following entry to your host table:
|
|
|
|
|
|
`127.0.0.1 petstore.swagger.io`
|
|
|
|
|
|
## Echo server
|
|
|
|
|
|
Echo server tests are newly added in Nov 2022. Eventually it will replace the PetStore server tests, which couldn't meet the growing requirements in terms of test coverage of the auto-generated code.
|
|
|
|
|
|
To run the server:
|
|
|
```
|
|
|
git clone https://github.com/wing328/http-echo-server -b openapi-generator-test-server
|
|
|
cd http-echo-server
|
|
|
npm install
|
|
|
npm start
|
|
|
```
|
|
|
|
|
|
Echo server OpenAPI spec:
|
|
|
```
|
|
|
modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
|
|
```
|
|
|
|
|
|
Example of a sample config:
|
|
|
```
|
|
|
generatorName: java
|
|
|
outputDir: samples/client/echo_api/java/native
|
|
|
library: native
|
|
|
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
|
|
|
templateDir: modules/openapi-generator/src/main/resources/Java
|
|
|
additionalProperties:
|
|
|
artifactId: echo-api-native
|
|
|
hideGenerationTimestamp: "true"
|
|
|
```
|
|
|
|
|
|
To facilitate testing, usually we create a helper to parse the response from the echo server, e.g. https://github.com/OpenAPITools/openapi-generator/blob/master/samples/client/echo_api/java/native/src/test/java/org/openapitools/client/EchoServerResponseParser.java |