|
| 1 | +/** |
| 2 | + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.13.0-SNAPSHOT). |
| 3 | + * https://openapi-generator.tech |
| 4 | + * Do not edit the class manually. |
| 5 | + */ |
| 6 | +package org.openapitools.api; |
| 7 | + |
| 8 | +import org.openapitools.model.Bar; |
| 9 | +import org.openapitools.model.BarCreate; |
| 10 | +import io.swagger.v3.oas.annotations.ExternalDocumentation; |
| 11 | +import io.swagger.v3.oas.annotations.Operation; |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; |
| 13 | +import io.swagger.v3.oas.annotations.Parameters; |
| 14 | +import io.swagger.v3.oas.annotations.media.ArraySchema; |
| 15 | +import io.swagger.v3.oas.annotations.media.Content; |
| 16 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 17 | +import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| 18 | +import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; |
| 20 | +import io.swagger.v3.oas.annotations.enums.ParameterIn; |
| 21 | +import org.springframework.http.HttpStatus; |
| 22 | +import org.springframework.http.MediaType; |
| 23 | +import org.springframework.http.ResponseEntity; |
| 24 | +import org.springframework.validation.annotation.Validated; |
| 25 | +import org.springframework.web.bind.annotation.*; |
| 26 | +import org.springframework.web.context.request.NativeWebRequest; |
| 27 | +import org.springframework.web.multipart.MultipartFile; |
| 28 | + |
| 29 | +import javax.validation.Valid; |
| 30 | +import javax.validation.constraints.*; |
| 31 | +import java.util.List; |
| 32 | +import java.util.Map; |
| 33 | +import java.util.Optional; |
| 34 | +import javax.annotation.Generated; |
| 35 | + |
| 36 | +@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", comments = "Generator version: 7.13.0-SNAPSHOT") |
| 37 | +@Validated |
| 38 | +@Tag(name = "Bar", description = "the Bar API") |
| 39 | +public interface BarApi { |
| 40 | + |
| 41 | + default Optional<NativeWebRequest> getRequest() { |
| 42 | + return Optional.empty(); |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * POST /bar : Create a Bar |
| 47 | + * |
| 48 | + * @param barCreate (required) |
| 49 | + * @return Bar created (status code 200) |
| 50 | + */ |
| 51 | + @Operation( |
| 52 | + operationId = "createBar", |
| 53 | + summary = "Create a Bar", |
| 54 | + tags = { "Bar" }, |
| 55 | + responses = { |
| 56 | + @ApiResponse(responseCode = "200", description = "Bar created", content = { |
| 57 | + @Content(mediaType = "application/json", schema = @Schema(implementation = Bar.class)) |
| 58 | + }) |
| 59 | + } |
| 60 | + ) |
| 61 | + @RequestMapping( |
| 62 | + method = RequestMethod.POST, |
| 63 | + value = "/bar", |
| 64 | + produces = { "application/json" }, |
| 65 | + consumes = { "application/json" } |
| 66 | + ) |
| 67 | + |
| 68 | + default ResponseEntity<Bar> createBar( |
| 69 | + @Parameter(name = "BarCreate", description = "", required = true) @Valid @RequestBody BarCreate barCreate |
| 70 | + ) { |
| 71 | + getRequest().ifPresent(request -> { |
| 72 | + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { |
| 73 | + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { |
| 74 | + String exampleString = "{ \"foo\" : { \"fooPropA\" : \"fooPropA\", \"fooPropB\" : \"fooPropB\" }, \"id\" : \"id\", \"fooPropB\" : \"fooPropB\", \"barPropA\" : \"barPropA\" }"; |
| 75 | + ApiUtil.setExampleResponse(request, "application/json", exampleString); |
| 76 | + break; |
| 77 | + } |
| 78 | + } |
| 79 | + }); |
| 80 | + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); |
| 81 | + |
| 82 | + } |
| 83 | + |
| 84 | +} |
0 commit comments