Я хотел бы, чтобы параметры были объектом. По этой или другой причине это, похоже, не работает. Генератор OpenAPI генерирует интерфейс API и т. Д., Но он не генерирует модель для объекта параметров. Я считаю, что это обеспечивает более структурированный способ справиться с опциями.
Код: Выделить всё
/fileuploadwithoptions:
post:
summary: Upload a file and processes it according to the options specified.
requestBody:
content:
multipart/form-data:
schema:
required:
- file
type: object
properties:
file:
type: string
format: binary
option1:
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (6.0.1).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.teradact.tokenizerplusserver.api;
import com.teradact.tokenizerplusserver.model.FileuploadwithoptionsPostRequestOptions;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import javax.validation.constraints.*;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Generated;
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2022-10-11T08:11:04.909499+02:00[Europe/Brussels]")
@Validated
@Tag(name = "fileuploadwithoptions", description = "the fileuploadwithoptions API")
public interface FileuploadwithoptionsApi {
default Optional getRequest() {
return Optional.empty();
}
/**
* POST /fileuploadwithoptions : Upload a file and processes it according to the options specified.
*
* @param file (required)
* @param option1 A descriptions for option 1. (optional)
* @param options (optional)
* @return The file. (status code 200)
* or bad input parameter (status code 400)
*/
@Operation(
operationId = "fileuploadwithoptionsPost",
summary = "Upload a file and processes it according to the options specified.",
responses = {
@ApiResponse(responseCode = "200", description = "The processed file.", content = {
@Content(mediaType = "application/octet-stream", schema = @Schema(implementation = org.springframework.core.io.Resource.class))
}),
@ApiResponse(responseCode = "400", description = "bad input parameter")
}
)
@RequestMapping(
method = RequestMethod.POST,
value = "/fileuploadwithoptions",
produces = { "application/octet-stream" },
consumes = { "multipart/form-data" }
)
default ResponseEntity fileuploadwithoptionsPost(
@Parameter(name = "file", description = "", required = true) @RequestPart(value = "file", required = true) MultipartFile file,
@Parameter(name = "option1", description = "A descriptions for option 1.") @Valid @RequestParam(value = "option1", required = false) String option1,
@Parameter(name = "options", description = "") @Valid @RequestParam(value = "options", required = false) FileuploadwithoptionsPostRequestOptions options
) {
return new ResponseEntity(HttpStatus.NOT_IMPLEMENTED);
}
}
"не может разрешить Symbol 'fileuploadwithoptionspostrequestoptions", поскольку модель для объекта просто не создана.
>
Подробнее здесь: https://stackoverflow.com/questions/740 ... ting-model