forked from loafle/openapi-generator-original
update samples
This commit is contained in:
parent
3ed59cd593
commit
3f8bce6695
@ -44,7 +44,7 @@ public interface AnotherFakeApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"client\" : \"client\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -567,6 +567,35 @@ public interface FakeApi {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GET /fake/response-with-example
|
||||
* This endpoint defines an example value for its response schema.
|
||||
*
|
||||
* @return Success (status code 200)
|
||||
*/
|
||||
@ApiOperation(
|
||||
tags = { "fake" },
|
||||
value = "",
|
||||
nickname = "testWithResultExample",
|
||||
notes = "This endpoint defines an example value for its response schema.",
|
||||
response = Integer.class
|
||||
)
|
||||
@ApiResponses({
|
||||
@ApiResponse(code = 200, message = "Success", response = Integer.class)
|
||||
})
|
||||
@RequestMapping(
|
||||
method = RequestMethod.GET,
|
||||
value = "/fake/response-with-example",
|
||||
produces = { "application/json" }
|
||||
)
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
default Mono<Integer> testWithResultExample(
|
||||
@ApiIgnore final ServerWebExchange exchange
|
||||
) {
|
||||
return getDelegate().testWithResultExample(exchange);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
|
||||
*
|
||||
|
@ -87,7 +87,7 @@ public interface FakeApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
|
||||
String exampleString = "{ \"my_string\" : \"my_string\", \"my_number\" : 0.8008281904610115, \"my_boolean\" : true }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -141,7 +141,7 @@ public interface FakeApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"UPPER_CASE_PROPERTY_SNAKE\" : \"UPPER_CASE_PROPERTY_SNAKE\", \"lower-case-property-dashes\" : \"lower-case-property-dashes\", \"property name with spaces\" : \"property name with spaces\", \"normalPropertyName\" : \"normalPropertyName\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ public interface FakeApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"client\" : \"client\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -361,6 +361,27 @@ public interface FakeApiDelegate {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /fake/response-with-example
|
||||
* This endpoint defines an example value for its response schema.
|
||||
*
|
||||
* @return Success (status code 200)
|
||||
* @see FakeApi#testWithResultExample
|
||||
*/
|
||||
default Mono<Integer> testWithResultExample(ServerWebExchange exchange) {
|
||||
Mono<Void> result = Mono.empty();
|
||||
exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED);
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "42";
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result.then(Mono.empty());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /fake/{petId}/uploadImageWithRequiredFile : uploads an image (required)
|
||||
*
|
||||
@ -380,7 +401,7 @@ public interface FakeApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public interface FakeClassnameTestApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"client\" : \"client\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -83,12 +83,12 @@ public interface PetApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -114,12 +114,12 @@ public interface PetApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "[ { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }, { \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" } ]";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -144,12 +144,12 @@ public interface PetApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"default-name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<Pet> <id>123456789</id> <Category> <id>123456789</id> <name>aeiou</name> </Category> <name>doggie</name> <photoUrls> <photoUrls>aeiou</photoUrls> </photoUrls> <tags> <Tag> <id>123456789</id> <name>aeiou</name> </Tag> </tags> <status>aeiou</status> </Pet>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -215,7 +215,7 @@ public interface PetApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -78,12 +78,12 @@ public interface StoreApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -107,12 +107,12 @@ public interface StoreApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<Order> <id>123456789</id> <petId>123456789</petId> <quantity>123</quantity> <shipDate>2000-01-23T04:56:07.000Z</shipDate> <status>aeiou</status> <complete>true</complete> </Order>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ public interface UserApiDelegate {
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
String exampleString = "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\" }";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/json"), exampleString);
|
||||
break;
|
||||
}
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) {
|
||||
String exampleString = "<User> <id>123456789</id> <username>aeiou</username> <firstName>aeiou</firstName> <lastName>aeiou</lastName> <email>aeiou</email> <password>aeiou</password> <phone>aeiou</phone> <userStatus>123</userStatus> </User>";
|
||||
result = ApiUtil.getExampleResponse(exchange, mediaType, exampleString);
|
||||
result = ApiUtil.getExampleResponse(exchange, MediaType.valueOf("application/xml"), exampleString);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1088,6 +1088,23 @@ paths:
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: fake
|
||||
/fake/response-with-example:
|
||||
get:
|
||||
description: This endpoint defines an example value for its response schema.
|
||||
operationId: testWithResultExample
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
example: 42
|
||||
type: integer
|
||||
description: Success
|
||||
tags:
|
||||
- fake
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: fake
|
||||
/fake/test-query-parameters:
|
||||
put:
|
||||
description: To test the collection format in query parameters
|
||||
|
Loading…
x
Reference in New Issue
Block a user