forked from loafle/openapi-generator-original
Minor improvement to Go client generator, move test case (#430)
* move test cases to under fake endpoint * remove trailing spaces in the template * update samples * add new file * minor fix to OAS3 spec
This commit is contained in:
@@ -9,6 +9,7 @@ import java.math.BigDecimal;
|
||||
import org.openapitools.model.Client;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import org.openapitools.model.ModelApiResponse;
|
||||
import java.time.OffsetDateTime;
|
||||
import org.openapitools.model.OuterComposite;
|
||||
import org.springframework.core.io.Resource;
|
||||
@@ -209,4 +210,30 @@ public interface FakeApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/fake/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
default ResponseEntity<Mono<ModelApiResponse>> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata, ServerWebExchange exchange) {
|
||||
Mono<ModelApiResponse> result = Mono.empty();
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}")
|
||||
.then(Mono.empty());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -224,30 +224,4 @@ public interface PetApi {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "uploads an image", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet", })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) })
|
||||
@RequestMapping(value = "/pet/{petId}/uploadImageWithRequiredFile",
|
||||
produces = { "application/json" },
|
||||
consumes = { "multipart/form-data" },
|
||||
method = RequestMethod.POST)
|
||||
default ResponseEntity<Mono<ModelApiResponse>> uploadFileWithRequiredFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata, ServerWebExchange exchange) {
|
||||
Mono<ModelApiResponse> result = Mono.empty();
|
||||
for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) {
|
||||
if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) {
|
||||
result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}")
|
||||
.then(Mono.empty());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -310,50 +310,6 @@ paths:
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/pet/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: multipart/form-data
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: pet
|
||||
/store/inventory:
|
||||
get:
|
||||
description: Returns a map of status codes to quantities
|
||||
@@ -1134,6 +1090,50 @@ paths:
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: $another-fake?
|
||||
/fake/{petId}/uploadImageWithRequiredFile:
|
||||
post:
|
||||
operationId: uploadFileWithRequiredFile
|
||||
parameters:
|
||||
- description: ID of pet to update
|
||||
in: path
|
||||
name: petId
|
||||
required: true
|
||||
schema:
|
||||
format: int64
|
||||
type: integer
|
||||
requestBody:
|
||||
content:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
properties:
|
||||
additionalMetadata:
|
||||
description: Additional data to pass to server
|
||||
type: string
|
||||
file:
|
||||
description: file to upload
|
||||
format: binary
|
||||
type: string
|
||||
required:
|
||||
- file
|
||||
required: true
|
||||
responses:
|
||||
200:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/ApiResponse'
|
||||
description: successful operation
|
||||
security:
|
||||
- petstore_auth:
|
||||
- write:pets
|
||||
- read:pets
|
||||
summary: uploads an image (required)
|
||||
tags:
|
||||
- pet
|
||||
x-contentType: multipart/form-data
|
||||
x-accepts: application/json
|
||||
x-tags:
|
||||
- tag: pet
|
||||
components:
|
||||
schemas:
|
||||
Category:
|
||||
|
||||
Reference in New Issue
Block a user