diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java index 1366797328a5..b2698dfd67b6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustAxumServerCodegen.java @@ -82,6 +82,8 @@ public class RustAxumServerCodegen extends AbstractRustCodegen implements Codege private static final String textXmlMimeType = "text/xml"; private static final String formUrlEncodedMimeType = "application/x-www-form-urlencoded"; private static final String jsonMimeType = "application/json"; + private static final String eventStreamMimeType = "text/event-stream"; + // RFC 7386 support private static final String mergePatchJsonMimeType = "application/merge-patch+json"; // RFC 7807 Support @@ -451,12 +453,17 @@ private boolean isMimetypeUnknown(String mimetype) { return "*/*".equals(mimetype); } + private boolean isMimetypeEventStream(String mimetype) { + return mimetype.toLowerCase(Locale.ROOT).startsWith(eventStreamMimeType); + } + boolean isMimetypePlain(String mimetype) { return !(isMimetypeUnknown(mimetype) || isMimetypeJson(mimetype) || isMimetypeWwwFormUrlEncoded(mimetype) || isMimetypeMultipartFormData(mimetype) || - isMimetypeMultipartRelated(mimetype)); + isMimetypeMultipartRelated(mimetype) || + isMimetypeEventStream(mimetype)); } @Override @@ -497,18 +504,10 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation // simply lists all the types, and then we add the correct imports to // the generated library. Set producesInfo = getProducesInfo(openAPI, operation); - boolean producesPlainText = false; - boolean producesFormUrlEncoded = false; if (producesInfo != null && !producesInfo.isEmpty()) { List> produces = new ArrayList<>(producesInfo.size()); for (String mimeType : producesInfo) { - if (isMimetypeWwwFormUrlEncoded(mimeType)) { - producesFormUrlEncoded = true; - } else if (isMimetypePlain(mimeType)) { - producesPlainText = true; - } - Map mediaType = new HashMap<>(); mediaType.put("mediaType", mimeType); @@ -532,10 +531,9 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation original = ModelUtils.getReferencedApiResponse(openAPI, original); // Create a unique responseID for this response, if one is not already specified with the "x-response-id" extension + // The x-response-id may have an appended suffix when multiple content types are present. if (!rsp.vendorExtensions.containsKey("x-response-id")) { String[] words = rsp.message.split("[^A-Za-z ]"); - - // build responseId from both status code and description String responseId = "Status" + rsp.code + ( ((words.length != 0) && (!words[0].trim().isEmpty())) ? "_" + camelize(words[0].replace(" ", "_")) : "" @@ -543,80 +541,115 @@ public CodegenOperation fromOperation(String path, String httpMethod, Operation rsp.vendorExtensions.put("x-response-id", responseId); } - if (rsp.dataType != null) { - // Get the mimetype which is produced by this response. Note - // that although in general responses produces a set of - // different mimetypes currently we only support 1 per - // response. - String firstProduces = null; + List producesTypes = new ArrayList<>(); - if (original.getContent() != null) { - firstProduces = original.getContent().keySet().stream().findFirst().orElse(null); - } + if (original.getContent() != null) { + producesTypes.addAll(original.getContent().keySet()); + } - // The output mime type. This allows us to do sensible fallback - // to JSON rather than using only the default operation - // mimetype. - String outputMime; - - if (firstProduces == null) { - if (producesFormUrlEncoded) { - outputMime = formUrlEncodedMimeType; - } else if (producesPlainText) { - if (bytesType.equals(rsp.dataType)) { - outputMime = octetMimeType; - } else { - outputMime = plainTextMimeType; - } - } else { - outputMime = jsonMimeType; - } - } else { - if (isMimetypeWwwFormUrlEncoded(firstProduces)) { - producesFormUrlEncoded = true; - producesPlainText = false; - } else if (isMimetypePlain(firstProduces)) { - producesFormUrlEncoded = false; - producesPlainText = true; - } else { - producesFormUrlEncoded = false; - producesPlainText = false; - } + List> responseContentTypes = new ArrayList<>(); - outputMime = firstProduces; + // If there are no content types (no body), create a single variant without content + if (producesTypes.isEmpty()) { + Map contentTypeInfo = new HashMap<>(); + + // Use the response-id directly as the variant name for responses without content + if (rsp.vendorExtensions.containsKey("x-response-id")) { + String baseId = (String) rsp.vendorExtensions.get("x-response-id"); + contentTypeInfo.put("x-variant-name", baseId); + } + + responseContentTypes.add(contentTypeInfo); + } else { + // Process each content type + for (String contentType : producesTypes) { + Map contentTypeInfo = new HashMap<>(); + contentTypeInfo.put("mediaType", contentType); + + String outputMime = contentType; // As we don't support XML, fallback to plain text if (isMimetypeXml(outputMime)) { outputMime = plainTextMimeType; } - } - rsp.vendorExtensions.put("x-mime-type", outputMime); - - if (producesFormUrlEncoded) { - rsp.vendorExtensions.put("x-produces-form-urlencoded", true); - } else if (producesPlainText) { - // Plain text means that there is not structured data in - // this response. So it'll either be a UTF-8 encoded string - // 'plainText' or some generic 'bytes'. - // - // Note that we don't yet distinguish between string/binary - // and string/bytes - that is we don't auto-detect whether - // base64 encoding should be done. They both look like - // 'producesBytes'. - if (bytesType.equals(rsp.dataType)) { - rsp.vendorExtensions.put("x-produces-bytes", true); + contentTypeInfo.put("x-output-mime-type", outputMime); + + // Special handling for json, form, and event stream types + if (isMimetypeJson(contentType)) { + contentTypeInfo.put("x-content-suffix", "Json"); + contentTypeInfo.put("x-serializer-json", true); + } else if (isMimetypeWwwFormUrlEncoded(contentType)) { + contentTypeInfo.put("x-content-suffix", "FormUrlEncoded"); + contentTypeInfo.put("x-serializer-form", true); + } else if (isMimetypeEventStream(contentType)) { + contentTypeInfo.put("x-content-suffix", "EventStream"); + contentTypeInfo.put("x-serializer-event-stream", true); } else { - rsp.vendorExtensions.put("x-produces-plain-text", true); + // Everything else is plain-text + contentTypeInfo.put("x-content-suffix", "PlainText"); + // Note: serializer flags will be set after determining the actual body type } - } else { - rsp.vendorExtensions.put("x-produces-json", true); - if (isObjectType(rsp.dataType)) { - rsp.dataType = objectType; + + // Group together the x-response-id and x-content-suffix created above in order to produce + // an enum variant name like StatusXXX_CamelizedDescription_Suffix + if (rsp.vendorExtensions.containsKey("x-response-id") && contentTypeInfo.containsKey("x-content-suffix")) { + String baseId = (String) rsp.vendorExtensions.get("x-response-id"); + String suffix = (String) contentTypeInfo.get("x-content-suffix"); + contentTypeInfo.put("x-variant-name", baseId + "_" + suffix); + } + + if (rsp.dataType != null || isMimetypeEventStream(contentType)) { + String bodyType; + if (contentTypeInfo.get("x-output-mime-type").equals(jsonMimeType)) { + bodyType = rsp.dataType; + } else if (contentTypeInfo.get("x-output-mime-type").equals(formUrlEncodedMimeType)) { + bodyType = stringType; + } else if (contentTypeInfo.get("x-output-mime-type").equals(plainTextMimeType)) { + bodyType = bytesType.equals(rsp.dataType) ? bytesType : stringType; + } else if (contentTypeInfo.get("x-output-mime-type").equals(octetMimeType)) { + // For octet-stream, always use ByteArray + bodyType = bytesType; + } else if (contentTypeInfo.get("x-output-mime-type").equals(eventStreamMimeType)) { + Schema ctSchema = Optional.ofNullable(original.getContent()) + .map(c -> c.get(contentType)) + .map(io.swagger.v3.oas.models.media.MediaType::getSchema) + .orElse(null); + if (ctSchema != null) { + String resolvedType = getTypeDeclaration(ctSchema); + bodyType = "std::pin::Pin>> + Send + 'static>>"; + } else { + // Fall back on string streaming + bodyType = "std::pin::Pin>> + Send + 'static>>"; + } + + // Inform downstream logic that there is a stream enum variant - this will result in a custom debug implementation + // for the enum along with stream handling in the server operation. + rsp.vendorExtensions.put("x-has-event-stream-content", true); + } else { + bodyType = stringType; + } + contentTypeInfo.put("x-body-type", bodyType); + contentTypeInfo.put("dataType", bodyType); // Also set dataType for template conditionals + + // Set serializer flags based on the actual body type for plain-text/octet-stream + if (!contentTypeInfo.containsKey("x-serializer-json") && + !contentTypeInfo.containsKey("x-serializer-form") && + !contentTypeInfo.containsKey("x-serializer-event-stream")) { + if (bytesType.equals(bodyType)) { + contentTypeInfo.put("x-serializer-bytes", true); + } else { + contentTypeInfo.put("x-serializer-plain", true); + } + } } + + responseContentTypes.add(contentTypeInfo); } } + rsp.vendorExtensions.put("x-response-content-types", responseContentTypes); + for (CodegenProperty header : rsp.headers) { if (uuidType.equals(header.dataType)) { additionalProperties.put("apiUsesUuid", true); @@ -919,6 +952,19 @@ private boolean postProcessOperationWithModels(final CodegenOperation op) { } } + boolean hasEventStreamContent = false; + if (op.responses != null) { + for (CodegenResponse response : op.responses) { + if (Boolean.TRUE.equals(response.vendorExtensions.get("x-has-event-stream-content"))) { + hasEventStreamContent = true; + break; + } + } + } + if (hasEventStreamContent) { + op.vendorExtensions.put("x-has-event-stream-content", true); + } + return hasAuthMethod; } diff --git a/modules/openapi-generator/src/main/resources/rust-axum/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-axum/Cargo.mustache index 92f89a371e4f..399236a5fcb7 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/Cargo.mustache @@ -51,6 +51,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/modules/openapi-generator/src/main/resources/rust-axum/response.mustache b/modules/openapi-generator/src/main/resources/rust-axum/response.mustache index d99db9516cd3..0be97950aa8b 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/response.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/response.mustache @@ -1,13 +1,34 @@ +{{#vendorExtensions}}{{#x-has-event-stream-content}} +// Manual Debug implementation needed due to Stream not implementing Debug +impl std::fmt::Debug for {{{operationId}}}Response { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { +{{#responses}} + {{#vendorExtensions}} + {{#x-response-content-types}} + {{{operationId}}}Response::{{{x-variant-name}}}{{^dataType}}{{#hasHeaders}} { .. }{{/hasHeaders}}{{/dataType}}{{#dataType}}{{^headers}}(..){{/headers}}{{#headers}} { body: _, .. }{{/headers}}{{/dataType}} => write!(f, "{{{x-variant-name}}}{{^dataType}}{{#hasHeaders}} {{ .. }} {{/hasHeaders}}{{/dataType}}{{#dataType}}{{^headers}}(..){{/headers}}{{#headers}} {{ body: _, .. }} {{/headers}}{{/dataType}}"), + {{^-last}} + {{/-last}} + {{/x-response-content-types}} + {{/vendorExtensions}} +{{/responses}} + } + } +} +{{/x-has-event-stream-content}}{{/vendorExtensions}} +{{#vendorExtensions}}{{^x-has-event-stream-content}} #[derive(Debug, PartialEq, Serialize, Deserialize)] +{{/x-has-event-stream-content}}{{/vendorExtensions}} #[must_use] #[allow(clippy::large_enum_variant)] pub enum {{{operationId}}}Response { {{#responses}} + {{#vendorExtensions}} + {{#x-response-content-types}} {{#message}} - /// {{{.}}}{{/message}} - {{#vendorExtensions}} - {{{x-response-id}}} - {{/vendorExtensions}} + /// {{{.}}} ({{{mediaType}}}) + {{/message}} + {{{x-variant-name}}} {{^dataType}} {{#hasHeaders}} { @@ -15,35 +36,11 @@ pub enum {{{operationId}}}Response { {{/dataType}} {{#dataType}} {{^hasHeaders}} - {{#vendorExtensions}} - {{#x-produces-plain-text}} - (String) - {{/x-produces-plain-text}} - {{#x-produces-bytes}} - (ByteArray) - {{/x-produces-bytes}} - {{^x-produces-plain-text}} - {{^x-produces-bytes}} - ({{{dataType}}}) - {{/x-produces-bytes}} - {{/x-produces-plain-text}} - {{/vendorExtensions}} + ({{{x-body-type}}}) {{/hasHeaders}} {{#hasHeaders}} { - {{#vendorExtensions}} - {{#x-produces-plain-text}} - body: String, - {{/x-produces-plain-text}} - {{#x-produces-bytes}} - body: ByteArray, - {{/x-produces-bytes}} - {{^x-produces-plain-text}} - {{^x-produces-bytes}} - body: {{{dataType}}}, - {{/x-produces-bytes}} - {{/x-produces-plain-text}} - {{/vendorExtensions}} + body: {{{x-body-type}}}, {{/hasHeaders}} {{/dataType}} {{#headers}} @@ -62,6 +59,11 @@ pub enum {{{operationId}}}Response { } {{/-last}} {{/headers}} + {{^-last}} + , + {{/-last}} + {{/x-response-content-types}} + {{/vendorExtensions}} {{^-last}} , {{/-last}} diff --git a/modules/openapi-generator/src/main/resources/rust-axum/server-operation.mustache b/modules/openapi-generator/src/main/resources/rust-axum/server-operation.mustache index c6d463f21791..2fa2f3df514b 100644 --- a/modules/openapi-generator/src/main/resources/rust-axum/server-operation.mustache +++ b/modules/openapi-generator/src/main/resources/rust-axum/server-operation.mustache @@ -289,7 +289,9 @@ let result = api_impl.as_ref().{{#vendorExtensions}}{{{x-operation-id}}}{{/vendo let resp = match result { Ok(rsp) => match rsp { {{#responses}} - apis::{{classFilename}}::{{{operationId}}}Response::{{#vendorExtensions}}{{x-response-id}}{{/vendorExtensions}} +{{#vendorExtensions}} +{{#x-response-content-types}} + apis::{{classFilename}}::{{{operationId}}}Response::{{{x-variant-name}}} {{#dataType}} {{^headers}} (body) @@ -317,6 +319,24 @@ let result = api_impl.as_ref().{{#vendorExtensions}}{{{x-operation-id}}}{{/vendo {{/headers}} {{/dataType}} => { +{{#dataType}} +{{#x-serializer-event-stream}} + // Convert TryStream to SSE stream + use futures::StreamExt; + use axum::response::IntoResponse; + let sse_stream = body.map(|result| { + match result { + Ok(data) => { + // Convert data to SSE Event + Ok(axum::response::sse::Event::default().json_data(data)?) + }, + Err(e) => Err(e) + } + }); + let body_response = axum::response::Sse::new(sse_stream).into_response(); + return Ok(body_response); +{{/x-serializer-event-stream}} +{{^x-serializer-event-stream}} {{#headers}} {{^required}} if let Some({{{name}}}) = {{{name}}} { @@ -348,60 +368,84 @@ let result = api_impl.as_ref().{{#vendorExtensions}}{{{x-operation-id}}}{{/vendo {{^range}} let mut response = response.status({{{code}}}); {{/range}} -{{#produces}} -{{#-first}} -{{#dataType}} -{{#vendorExtensions}} { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert( CONTENT_TYPE, - HeaderValue::from_static("{{{x-mime-type}}}")); + HeaderValue::from_static("{{{x-output-mime-type}}}")); } - -{{/vendorExtensions}} -{{/dataType}} -{{/-first}} -{{/produces}} -{{#dataType}} -{{#vendorExtensions}} -{{#x-produces-json}} +{{#x-serializer-json}} {{^allowBlockingResponseSerialize}} + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || {{/allowBlockingResponseSerialize}} {{#allowBlockingResponseSerialize}} let body_content = {{/allowBlockingResponseSerialize}} - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&{{^allowBlockingResponseSerialize}}body_clone{{/allowBlockingResponseSerialize}}{{#allowBlockingResponseSerialize}}body{{/allowBlockingResponseSerialize}}).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }){{^allowBlockingResponseSerialize}}).await.unwrap(){{/allowBlockingResponseSerialize}}?; -{{/x-produces-json}} -{{#x-produces-form-urlencoded}} +{{/x-serializer-json}} +{{#x-serializer-form}} {{^allowBlockingResponseSerialize}} + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || {{/allowBlockingResponseSerialize}} {{#allowBlockingResponseSerialize}} let body_content = {{/allowBlockingResponseSerialize}} - serde_html_form::to_string(body).map_err(|e| { + serde_html_form::to_string({{^allowBlockingResponseSerialize}}body_clone{{/allowBlockingResponseSerialize}}{{#allowBlockingResponseSerialize}}body{{/allowBlockingResponseSerialize}}).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }){{^allowBlockingResponseSerialize}}).await.unwrap(){{/allowBlockingResponseSerialize}}?; -{{/x-produces-form-urlencoded}} -{{#x-produces-bytes}} - let body_content = body.0; -{{/x-produces-bytes}} -{{#x-produces-plain-text}} +{{/x-serializer-form}} +{{#x-serializer-plain}} let body_content = body; -{{/x-produces-plain-text}} -{{/vendorExtensions}} +{{/x-serializer-plain}} +{{#x-serializer-bytes}} + let body_content = body.0; +{{/x-serializer-bytes}} response.body(Body::from(body_content)) +{{/x-serializer-event-stream}} {{/dataType}} {{^dataType}} +{{#headers}} + {{^required}} + if let Some({{{name}}}) = {{{name}}} { + {{/required}} + let {{{name}}} = match header::IntoHeaderValue({{{name}}}).try_into() { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling {{name}} header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers.insert( + HeaderName::from_static("{{{nameInLowerCase}}}"), + {{name}} + ); + } + {{^required}} + } + {{/required}} +{{/headers}} +{{#range}} + response.status::(body.code.parse().unwrap()); // {{{code}}} +{{/range}} +{{^range}} + let mut response = response.status({{{code}}}); +{{/range}} response.body(Body::empty()) {{/dataType}} }, +{{/x-response-content-types}} +{{/vendorExtensions}} {{/responses}} }, Err({{#ownedRequest}}_{{/ownedRequest}}why) => { diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustAxumServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustAxumServerCodegenTest.java index bb4150d38089..5b7a43f7d53a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustAxumServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/rust/RustAxumServerCodegenTest.java @@ -34,4 +34,123 @@ public void testPreventDuplicateOperationDeclaration() throws IOException { TestUtils.assertFileExists(outputPath); TestUtils.assertFileContains(outputPath, routerSpec); } + + @Test + public void testMultipleContentTypesPerStatusCode() throws IOException { + Path target = Files.createTempDirectory("test"); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust-axum") + .setInputSpec("src/test/resources/3_1/rust-axum/test-multiple-content-types.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + + List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiPath = Path.of(target.toString(), "/src/apis/default.rs"); + TestUtils.assertFileExists(apiPath); + + TestUtils.assertFileContains(apiPath, "pub enum TestGetResponse"); + + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_Json"); + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_EventStream"); + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_PlainText"); + + TestUtils.assertFileContains(apiPath, "(application/json)"); + TestUtils.assertFileContains(apiPath, "(text/event-stream)"); + TestUtils.assertFileContains(apiPath, "(text/plain)"); + + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_Json"); + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_EventStream"); + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithMultipleContentTypes_PlainText"); + + TestUtils.assertFileContains(apiPath, "(models::TestGet200Response)"); + TestUtils.assertFileContains(apiPath, "(std::pin::Pin>> + Send + 'static>>)"); + TestUtils.assertFileContains(apiPath, "(String)"); + + TestUtils.assertFileContains(apiPath, "Status400_BadRequest_Json"); + } + + @Test + public void testComplexEventStreamType() throws IOException { + Path target = Files.createTempDirectory("test"); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust-axum") + .setInputSpec("src/test/resources/3_1/rust-axum/test-complex-event-stream.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + + List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiPath = Path.of(target.toString(), "/src/apis/default.rs"); + TestUtils.assertFileExists(apiPath); + + TestUtils.assertFileContains(apiPath, "pub enum EventsGetResponse"); + TestUtils.assertFileContains(apiPath, "Status200_SuccessResponseWithComplexEventStream_EventStream"); + TestUtils.assertFileContains(apiPath, "(text/event-stream)"); + TestUtils.assertFileContains(apiPath, "(std::pin::Pin>> + Send + 'static>>)"); + TestUtils.assertFileContains(apiPath, "Status400_BadRequest_Json"); + } + + @Test + public void testOneOfResponse() throws IOException { + Path target = Files.createTempDirectory("test"); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust-axum") + .setInputSpec("src/test/resources/3_1/rust-axum/test-oneof-response.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + + List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiPath = Path.of(target.toString(), "/src/apis/default.rs"); + TestUtils.assertFileExists(apiPath); + + TestUtils.assertFileContains(apiPath, "pub enum PetsGetResponse"); + + TestUtils.assertFileContains(apiPath, "Status200_APetObject_Json"); + TestUtils.assertFileContains(apiPath, "Status200_APetObject_EventStream"); + TestUtils.assertFileContains(apiPath, "(application/json)"); + TestUtils.assertFileContains(apiPath, "(text/event-stream)"); + TestUtils.assertFileContains(apiPath, "(models::PetsGet200Response)"); + TestUtils.assertFileContains(apiPath, "(std::pin::Pin>> + Send + 'static>>)"); + TestUtils.assertFileContains(apiPath, "Status400_BadRequest_Json"); + } + + @Test + public void testAnyOfAllOfResponse() throws IOException { + Path target = Files.createTempDirectory("test"); + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("rust-axum") + .setInputSpec("src/test/resources/3_1/rust-axum/test-anyof-allof-response.yaml") + .setSkipOverwrite(false) + .setOutputDir(target.toAbsolutePath().toString().replace("\\", "/")); + + List files = new DefaultGenerator().opts(configurator.toClientOptInput()).generate(); + files.forEach(File::deleteOnExit); + + Path apiPath = Path.of(target.toString(), "/src/apis/default.rs"); + TestUtils.assertFileExists(apiPath); + + TestUtils.assertFileContains(apiPath, "pub enum AnimalsGetResponse"); + TestUtils.assertFileContains(apiPath, "pub enum HybridGetResponse"); + + TestUtils.assertFileContains(apiPath, "Status200_AnAnimalObject_Json"); + TestUtils.assertFileContains(apiPath, "Status200_AnAnimalObject_EventStream"); + + TestUtils.assertFileContains(apiPath, "Status200_AHybridAnimal_Json"); + TestUtils.assertFileContains(apiPath, "Status200_AHybridAnimal_EventStream"); + + TestUtils.assertFileContains(apiPath, "(application/json)"); + TestUtils.assertFileContains(apiPath, "(text/event-stream)"); + + TestUtils.assertFileContains(apiPath, "(models::AnimalsGet200Response)"); + TestUtils.assertFileContains(apiPath, "(models::HybridGet200Response)"); + TestUtils.assertFileContains(apiPath, "(std::pin::Pin>> + Send + 'static>>)"); + TestUtils.assertFileContains(apiPath, "(std::pin::Pin>> + Send + 'static>>)"); + + TestUtils.assertFileContains(apiPath, "Status400_BadRequest_Json"); + } } \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-anyof-allof-response.yaml b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-anyof-allof-response.yaml new file mode 100644 index 000000000000..1001916e278b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-anyof-allof-response.yaml @@ -0,0 +1,100 @@ +openapi: 3.0.0 +info: + title: AnyOf AllOf Response API + version: 1.0.0 +paths: + /animals: + get: + summary: Get an animal (anyOf test) + responses: + '200': + description: An animal object + content: + application/json: + schema: + anyOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Bird' + text/event-stream: + schema: + anyOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Bird' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string + /hybrid: + get: + summary: Get a hybrid animal (allOf test) + responses: + '200': + description: A hybrid animal + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/BaseAnimal' + - $ref: '#/components/schemas/FlyingAnimal' + text/event-stream: + schema: + allOf: + - $ref: '#/components/schemas/BaseAnimal' + - $ref: '#/components/schemas/FlyingAnimal' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string +components: + schemas: + BaseAnimal: + type: object + properties: + name: + type: string + age: + type: integer + required: + - name + FlyingAnimal: + type: object + properties: + canFly: + type: boolean + maxAltitude: + type: integer + required: + - canFly + Dog: + type: object + properties: + bark: + type: boolean + breed: + type: string + Cat: + type: object + properties: + hunts: + type: boolean + age: + type: integer + Bird: + type: object + properties: + canFly: + type: boolean + species: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-complex-event-stream.yaml b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-complex-event-stream.yaml new file mode 100644 index 000000000000..66f13d477247 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-complex-event-stream.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: Test API with Complex Event Stream + version: 1.0.0 +paths: + /events: + get: + summary: Event stream with complex data type + responses: + '200': + description: Success response with complex event stream + content: + text/event-stream: + schema: + type: object + properties: + id: + type: string + format: uuid + timestamp: + type: string + format: date-time + event_type: + type: string + enum: [user_action, system_event, error] + data: + type: object + properties: + user_id: + type: integer + action: + type: string + metadata: + type: object + additionalProperties: true + severity: + type: string + enum: [low, medium, high, critical] + required: [id, timestamp, event_type, data] + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-multiple-content-types.yaml b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-multiple-content-types.yaml new file mode 100644 index 000000000000..870540f70937 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-multiple-content-types.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +info: + title: Test API + version: 1.0.0 +paths: + /test: + get: + summary: Test endpoint with multiple content types + responses: + '200': + description: Success response with multiple content types + content: + application/json: + schema: + type: object + properties: + message: + type: string + text/event-stream: + schema: + type: string + text/plain: + schema: + type: string + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string diff --git a/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-oneof-response.yaml b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-oneof-response.yaml new file mode 100644 index 000000000000..35fe96a09fbd --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_1/rust-axum/test-oneof-response.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.0 +info: + title: OneOf Response API + version: 1.0.0 +paths: + /pets: + get: + summary: Get a pet + responses: + '200': + description: A pet object + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + text/event-stream: + schema: + oneOf: + - $ref: '#/components/schemas/Dog' + - $ref: '#/components/schemas/Cat' + '400': + description: Bad request + content: + application/json: + schema: + type: object + properties: + error: + type: string +components: + schemas: + Dog: + type: object + properties: + bark: + type: boolean + breed: + type: string + enum: [Dingo, Husky, Retriever, Shepherd] + Cat: + type: object + properties: + hunts: + type: boolean + age: + type: integer diff --git a/samples/server/petstore/rust-axum/output/apikey-authorization/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/apikey-authorization/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/apikey-authorization/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/apikey-authorization/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/apikey-authorization/Cargo.toml b/samples/server/petstore/rust-axum/output/apikey-authorization/Cargo.toml index 0746dcfc636c..e4cf2b096aec 100644 --- a/samples/server/petstore/rust-axum/output/apikey-authorization/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/apikey-authorization/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/apikey-authorization/README.md b/samples/server/petstore/rust-axum/output/apikey-authorization/README.md index 6acf6afe159e..a548e596e3e9 100644 --- a/samples/server/petstore/rust-axum/output/apikey-authorization/README.md +++ b/samples/server/petstore/rust-axum/output/apikey-authorization/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/apikey-authorization/src/apis/payments.rs b/samples/server/petstore/rust-axum/output/apikey-authorization/src/apis/payments.rs index 32766efa6d14..7d19c4ec2dcb 100644 --- a/samples/server/petstore/rust-axum/output/apikey-authorization/src/apis/payments.rs +++ b/samples/server/petstore/rust-axum/output/apikey-authorization/src/apis/payments.rs @@ -11,28 +11,28 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPaymentMethodByIdResponse { - /// OK - the request has succeeded. - Status200_OK(models::PaymentMethod), - /// Unprocessable Entity - a request validation error. - Status422_UnprocessableEntity(models::CheckoutError), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(models::PaymentMethod), + /// Unprocessable Entity - a request validation error. (application/json) + Status422_UnprocessableEntity_Json(models::CheckoutError), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPaymentMethodsResponse { - /// OK - the request has succeeded. - Status200_OK(Vec), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(Vec), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum PostMakePaymentResponse { - /// OK - the request has succeeded. - Status200_OK(models::PaymentResult), - /// Unprocessable Entity - a request validation error. - Status422_UnprocessableEntity(models::CheckoutError), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(models::PaymentResult), + /// Unprocessable Entity - a request validation error. (application/json) + Status422_UnprocessableEntity_Json(models::CheckoutError), } /// Payments APIs - Authorization. diff --git a/samples/server/petstore/rust-axum/output/apikey-authorization/src/server/mod.rs b/samples/server/petstore/rust-axum/output/apikey-authorization/src/server/mod.rs index 876aee9a3abb..bd37d7487a5c 100644 --- a/samples/server/petstore/rust-axum/output/apikey-authorization/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/apikey-authorization/src/server/mod.rs @@ -123,16 +123,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::GetPaymentMethodByIdResponse::Status200_OK(body) => { + apis::payments::GetPaymentMethodByIdResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -141,16 +141,18 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity(body) => { + apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity_Json( + body, + ) => { let mut response = response.status(422); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -276,16 +278,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::GetPaymentMethodsResponse::Status200_OK(body) => { + apis::payments::GetPaymentMethodsResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -431,16 +433,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::PostMakePaymentResponse::Status200_OK(body) => { + apis::payments::PostMakePaymentResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -449,16 +451,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity(body) => { + apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity_Json(body) => { let mut response = response.status(422); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/apikey-auths/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/Cargo.toml b/samples/server/petstore/rust-axum/output/apikey-auths/Cargo.toml index eaffaa470cd9..d371e4cd733a 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/apikey-auths/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/README.md b/samples/server/petstore/rust-axum/output/apikey-auths/README.md index 373495c2e18b..7a5635e3095b 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/README.md +++ b/samples/server/petstore/rust-axum/output/apikey-auths/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs b/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs index 2bdf4d433d21..50874167eff0 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs +++ b/samples/server/petstore/rust-axum/output/apikey-auths/src/apis/payments.rs @@ -11,28 +11,28 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPaymentMethodByIdResponse { - /// OK - the request has succeeded. - Status200_OK(models::PaymentMethod), - /// Unprocessable Entity - a request validation error. - Status422_UnprocessableEntity(models::CheckoutError), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(models::PaymentMethod), + /// Unprocessable Entity - a request validation error. (application/json) + Status422_UnprocessableEntity_Json(models::CheckoutError), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPaymentMethodsResponse { - /// OK - the request has succeeded. - Status200_OK(Vec), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(Vec), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum PostMakePaymentResponse { - /// OK - the request has succeeded. - Status200_OK(models::PaymentResult), - /// Unprocessable Entity - a request validation error. - Status422_UnprocessableEntity(models::CheckoutError), + /// OK - the request has succeeded. (application/json) + Status200_OK_Json(models::PaymentResult), + /// Unprocessable Entity - a request validation error. (application/json) + Status422_UnprocessableEntity_Json(models::CheckoutError), } /// Payments diff --git a/samples/server/petstore/rust-axum/output/apikey-auths/src/server/mod.rs b/samples/server/petstore/rust-axum/output/apikey-auths/src/server/mod.rs index 45b533b4450b..3932df66e1b2 100644 --- a/samples/server/petstore/rust-axum/output/apikey-auths/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/apikey-auths/src/server/mod.rs @@ -96,16 +96,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::GetPaymentMethodByIdResponse::Status200_OK(body) => { + apis::payments::GetPaymentMethodByIdResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -114,16 +114,18 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity(body) => { + apis::payments::GetPaymentMethodByIdResponse::Status422_UnprocessableEntity_Json( + body, + ) => { let mut response = response.status(422); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -198,16 +200,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::GetPaymentMethodsResponse::Status200_OK(body) => { + apis::payments::GetPaymentMethodsResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -305,16 +307,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::payments::PostMakePaymentResponse::Status200_OK(body) => { + apis::payments::PostMakePaymentResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -323,16 +325,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity(body) => { + apis::payments::PostMakePaymentResponse::Status422_UnprocessableEntity_Json(body) => { let mut response = response.status(422); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/multipart-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/Cargo.toml b/samples/server/petstore/rust-axum/output/multipart-v3/Cargo.toml index 3d86baffa19f..b93f03203928 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/multipart-v3/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/README.md b/samples/server/petstore/rust-axum/output/multipart-v3/README.md index 25fcd41615d4..adc2dfdde37f 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/README.md +++ b/samples/server/petstore/rust-axum/output/multipart-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs index b9cdb2c1dfd4..cd711c074170 100644 --- a/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/multipart-v3/src/apis/default.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultipartRelatedRequestPostResponse { - /// OK + /// OK () Status201_OK, } @@ -19,7 +19,7 @@ pub enum MultipartRelatedRequestPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultipartRequestPostResponse { - /// OK + /// OK () Status201_OK, } @@ -27,7 +27,7 @@ pub enum MultipartRequestPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultipleIdenticalMimeTypesPostResponse { - /// OK + /// OK () Status200_OK, } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/openapi-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/Cargo.toml b/samples/server/petstore/rust-axum/output/openapi-v3/Cargo.toml index 3ad8cd54cd75..4d4ae90e4187 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/openapi-v3/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/README.md b/samples/server/petstore/rust-axum/output/openapi-v3/README.md index d01db91f0244..e687d2f4aa74 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/README.md +++ b/samples/server/petstore/rust-axum/output/openapi-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.7 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs index 99f8d44cbe1e..0b155b49f0c2 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/default.rs @@ -11,19 +11,19 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum AnyOfGetResponse { - /// Success - Status200_Success(models::AnyOfObject), - /// AlternateSuccess - Status201_AlternateSuccess(models::Model12345AnyOfObject), - /// AnyOfSuccess - Status202_AnyOfSuccess(models::AnyOfGet202Response), + /// Success (application/json) + Status200_Success_Json(models::AnyOfObject), + /// AlternateSuccess (application/json) + Status201_AlternateSuccess_Json(models::Model12345AnyOfObject), + /// AnyOfSuccess (application/json) + Status202_AnyOfSuccess_Json(models::AnyOfGet202Response), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum CallbackWithHeaderPostResponse { - /// OK + /// OK () Status204_OK, } @@ -31,7 +31,7 @@ pub enum CallbackWithHeaderPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum ComplexQueryParamGetResponse { - /// Success + /// Success () Status200_Success, } @@ -39,7 +39,7 @@ pub enum ComplexQueryParamGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum EnumInPathPathParamGetResponse { - /// Success + /// Success () Status200_Success, } @@ -47,15 +47,15 @@ pub enum EnumInPathPathParamGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum ExamplesTestResponse { - /// OK - Status200_OK(models::AdditionalPropertiesReferencedAnyOfObject), + /// OK (application/json) + Status200_OK_Json(models::AdditionalPropertiesReferencedAnyOfObject), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum FormTestResponse { - /// OK + /// OK () Status200_OK, } @@ -63,7 +63,7 @@ pub enum FormTestResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetWithBooleanParameterResponse { - /// OK + /// OK () Status200_OK, } @@ -71,7 +71,7 @@ pub enum GetWithBooleanParameterResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum JsonComplexQueryParamGetResponse { - /// Success + /// Success () Status200_Success, } @@ -79,7 +79,7 @@ pub enum JsonComplexQueryParamGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum MandatoryRequestHeaderGetResponse { - /// Success + /// Success () Status200_Success, } @@ -87,35 +87,35 @@ pub enum MandatoryRequestHeaderGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum MergePatchJsonGetResponse { - /// merge-patch+json-encoded response - Status200_Merge(models::AnotherXmlObject), + /// merge-patch+json-encoded response (application/merge-patch+json) + Status200_Merge_Json(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultigetGetResponse { - /// JSON rsp - Status200_JSONRsp(models::AnotherXmlObject), - /// XML rsp - Status201_XMLRsp(String), - /// octet rsp - Status202_OctetRsp(ByteArray), - /// string rsp - Status203_StringRsp(String), - /// Duplicate Response long text. One. - Status204_DuplicateResponseLongText(models::AnotherXmlObject), - /// Duplicate Response long text. Two. - Status205_DuplicateResponseLongText(models::AnotherXmlObject), - /// Duplicate Response long text. Three. - Status206_DuplicateResponseLongText(models::AnotherXmlObject), + /// JSON rsp (application/json) + Status200_JSONRsp_Json(models::AnotherXmlObject), + /// XML rsp (application/xml) + Status201_XMLRsp_PlainText(String), + /// octet rsp (application/octet-stream) + Status202_OctetRsp_PlainText(ByteArray), + /// string rsp (text/plain) + Status203_StringRsp_PlainText(String), + /// Duplicate Response long text. One. (application/json) + Status204_DuplicateResponseLongText_Json(models::AnotherXmlObject), + /// Duplicate Response long text. Two. (application/json) + Status205_DuplicateResponseLongText_Json(models::AnotherXmlObject), + /// Duplicate Response long text. Three. (application/json) + Status206_DuplicateResponseLongText_Json(models::AnotherXmlObject), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultipleAuthSchemeGetResponse { - /// Check that limiting to multiple required auth schemes works + /// Check that limiting to multiple required auth schemes works () Status200_CheckThatLimitingToMultipleRequiredAuthSchemesWorks, } @@ -123,7 +123,7 @@ pub enum MultipleAuthSchemeGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBGetResponse { - /// Success + /// Success () Status200_Success, } @@ -131,15 +131,15 @@ pub enum MultiplePathParamsWithVeryLongPathToTestFormattingPathParamAPathParamBG #[must_use] #[allow(clippy::large_enum_variant)] pub enum OneOfGetResponse { - /// Success - Status200_Success(models::OneOfGet200Response), + /// Success (application/json) + Status200_Success_Json(models::OneOfGet200Response), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum OverrideServerGetResponse { - /// Success. + /// Success. () Status204_Success, } @@ -147,15 +147,15 @@ pub enum OverrideServerGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum ParamgetGetResponse { - /// JSON rsp - Status200_JSONRsp(models::AnotherXmlObject), + /// JSON rsp (application/json) + Status200_JSONRsp_Json(models::AnotherXmlObject), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum ReadonlyAuthSchemeGetResponse { - /// Check that limiting to a single required auth scheme works + /// Check that limiting to a single required auth scheme works () Status200_CheckThatLimitingToASingleRequiredAuthSchemeWorks, } @@ -163,7 +163,7 @@ pub enum ReadonlyAuthSchemeGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum RegisterCallbackPostResponse { - /// OK + /// OK () Status204_OK, } @@ -171,7 +171,7 @@ pub enum RegisterCallbackPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum RequiredOctetStreamPutResponse { - /// OK + /// OK () Status200_OK, } @@ -179,14 +179,14 @@ pub enum RequiredOctetStreamPutResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum ResponsesWithHeadersGetResponse { - /// Success - Status200_Success { + /// Success (application/json) + Status200_Success_Json { body: String, success_info: String, bool_header: Option, object_header: Option, }, - /// Precondition Failed + /// Precondition Failed () Status412_PreconditionFailed { further_info: Option, failure_info: Option, @@ -197,19 +197,19 @@ pub enum ResponsesWithHeadersGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Rfc7807GetResponse { - /// OK - Status204_OK(models::ObjectWithArrayOfObjects), - /// NotFound - Status404_NotFound(models::ObjectWithArrayOfObjects), - /// NotAcceptable - Status406_NotAcceptable(String), + /// OK (application/json) + Status204_OK_Json(models::ObjectWithArrayOfObjects), + /// NotFound (application/problem+json) + Status404_NotFound_Json(String), + /// NotAcceptable (application/problem+xml) + Status406_NotAcceptable_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum TwoFirstLetterHeadersResponse { - /// OK + /// OK () Status200_OK, } @@ -217,7 +217,7 @@ pub enum TwoFirstLetterHeadersResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UntypedPropertyGetResponse { - /// Check that untyped properties works + /// Check that untyped properties works () Status200_CheckThatUntypedPropertiesWorks, } @@ -225,17 +225,17 @@ pub enum UntypedPropertyGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UuidGetResponse { - /// Duplicate Response long text. One. - Status200_DuplicateResponseLongText(uuid::Uuid), + /// Duplicate Response long text. One. (application/json) + Status200_DuplicateResponseLongText_Json(uuid::Uuid), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum XmlExtraPostResponse { - /// OK + /// OK () Status201_OK, - /// Bad Request + /// Bad Request () Status400_BadRequest, } @@ -243,9 +243,9 @@ pub enum XmlExtraPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum XmlOtherPostResponse { - /// OK - Status201_OK(String), - /// Bad Request + /// OK (text/xml) + Status201_OK_PlainText(String), + /// Bad Request () Status400_BadRequest, } @@ -253,9 +253,9 @@ pub enum XmlOtherPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum XmlOtherPutResponse { - /// OK + /// OK () Status201_OK, - /// Bad Request + /// Bad Request () Status400_BadRequest, } @@ -263,9 +263,9 @@ pub enum XmlOtherPutResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum XmlPostResponse { - /// OK + /// OK () Status201_OK, - /// Bad Request + /// Bad Request () Status400_BadRequest, } @@ -273,9 +273,9 @@ pub enum XmlPostResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum XmlPutResponse { - /// OK + /// OK () Status201_OK, - /// Bad Request + /// Bad Request () Status400_BadRequest, } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs index d4ea2e89cb40..53860fe4fd78 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/info_repo.rs @@ -11,8 +11,8 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetRepoInfoResponse { - /// OK - Status200_OK(String), + /// OK (application/json) + Status200_OK_Json(String), } /// InfoRepo diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs index 7f454233599b..21b557e477b5 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/apis/repo.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateRepoResponse { - /// Success + /// Success () Status200_Success, } diff --git a/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs b/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs index 0273bbe4ca35..63c4981dfea8 100644 --- a/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/openapi-v3/src/server/mod.rs @@ -156,16 +156,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::AnyOfGetResponse::Status200_Success(body) => { + apis::default::AnyOfGetResponse::Status200_Success_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -174,16 +174,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::AnyOfGetResponse::Status201_AlternateSuccess(body) => { + apis::default::AnyOfGetResponse::Status201_AlternateSuccess_Json(body) => { let mut response = response.status(201); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -192,16 +192,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::AnyOfGetResponse::Status202_AnyOfSuccess(body) => { + apis::default::AnyOfGetResponse::Status202_AnyOfSuccess_Json(body) => { let mut response = response.status(202); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -450,16 +450,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::ExamplesTestResponse::Status200_OK(body) => { + apis::default::ExamplesTestResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -805,7 +805,7 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::MergePatchJsonGetResponse::Status200_Merge(body) => { + apis::default::MergePatchJsonGetResponse::Status200_Merge_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); @@ -814,9 +814,9 @@ where HeaderValue::from_static("application/merge-patch+json"), ); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -877,16 +877,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::MultigetGetResponse::Status200_JSONRsp(body) => { + apis::default::MultigetGetResponse::Status200_JSONRsp_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -895,17 +895,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status201_XMLRsp(body) => { + apis::default::MultigetGetResponse::Status201_XMLRsp_PlainText(body) => { let mut response = response.status(201); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status202_OctetRsp(body) => { + apis::default::MultigetGetResponse::Status202_OctetRsp_PlainText(body) => { let mut response = response.status(202); { let mut response_headers = response.headers_mut().unwrap(); @@ -914,30 +913,28 @@ where HeaderValue::from_static("application/octet-stream"), ); } - let body_content = body.0; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status203_StringRsp(body) => { + apis::default::MultigetGetResponse::Status203_StringRsp_PlainText(body) => { let mut response = response.status(203); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status204_DuplicateResponseLongText(body) => { + apis::default::MultigetGetResponse::Status204_DuplicateResponseLongText_Json(body) => { let mut response = response.status(204); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -946,16 +943,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status205_DuplicateResponseLongText(body) => { + apis::default::MultigetGetResponse::Status205_DuplicateResponseLongText_Json(body) => { let mut response = response.status(205); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -964,16 +961,16 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::MultigetGetResponse::Status206_DuplicateResponseLongText(body) => { + apis::default::MultigetGetResponse::Status206_DuplicateResponseLongText_Json(body) => { let mut response = response.status(206); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1162,16 +1159,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::OneOfGetResponse::Status200_Success(body) => { + apis::default::OneOfGetResponse::Status200_Success_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1293,16 +1290,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::ParamgetGetResponse::Status200_JSONRsp(body) => { + apis::default::ParamgetGetResponse::Status200_JSONRsp_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1543,7 +1540,7 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::ResponsesWithHeadersGetResponse::Status200_Success { + apis::default::ResponsesWithHeadersGetResponse::Status200_Success_Json { body, success_info, bool_header, @@ -1600,9 +1597,9 @@ where response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1702,16 +1699,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::Rfc7807GetResponse::Status204_OK(body) => { + apis::default::Rfc7807GetResponse::Status204_OK_Json(body) => { let mut response = response.status(204); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1720,7 +1717,7 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::Rfc7807GetResponse::Status404_NotFound(body) => { + apis::default::Rfc7807GetResponse::Status404_NotFound_Json(body) => { let mut response = response.status(404); { let mut response_headers = response.headers_mut().unwrap(); @@ -1729,9 +1726,9 @@ where HeaderValue::from_static("application/problem+json"), ); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1740,13 +1737,12 @@ where .unwrap()?; response.body(Body::from(body_content)) } - apis::default::Rfc7807GetResponse::Status406_NotAcceptable(body) => { + apis::default::Rfc7807GetResponse::Status406_NotAcceptable_PlainText(body) => { let mut response = response.status(406); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } @@ -1972,16 +1968,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::UuidGetResponse::Status200_DuplicateResponseLongText(body) => { + apis::default::UuidGetResponse::Status200_DuplicateResponseLongText_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -2116,13 +2112,12 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::XmlOtherPostResponse::Status201_OK(body) => { + apis::default::XmlOtherPostResponse::Status201_OK_PlainText(body) => { let mut response = response.status(201); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } @@ -2388,16 +2383,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::info_repo::GetRepoInfoResponse::Status200_OK(body) => { + apis::info_repo::GetRepoInfoResponse::Status200_OK_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) diff --git a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ops-v3/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/Cargo.toml b/samples/server/petstore/rust-axum/output/ops-v3/Cargo.toml index 01a33e010d1c..5e9f830e5335 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/ops-v3/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/ops-v3/README.md b/samples/server/petstore/rust-axum/output/ops-v3/README.md index 79bbb55e5b98..b71ac1a6c8ca 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/README.md +++ b/samples/server/petstore/rust-axum/output/ops-v3/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs b/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs index cbae47c7a871..e4f3aab158e5 100644 --- a/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/ops-v3/src/apis/default.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op10GetResponse { - /// OK + /// OK () Status200_OK, } @@ -19,7 +19,7 @@ pub enum Op10GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op11GetResponse { - /// OK + /// OK () Status200_OK, } @@ -27,7 +27,7 @@ pub enum Op11GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op12GetResponse { - /// OK + /// OK () Status200_OK, } @@ -35,7 +35,7 @@ pub enum Op12GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op13GetResponse { - /// OK + /// OK () Status200_OK, } @@ -43,7 +43,7 @@ pub enum Op13GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op14GetResponse { - /// OK + /// OK () Status200_OK, } @@ -51,7 +51,7 @@ pub enum Op14GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op15GetResponse { - /// OK + /// OK () Status200_OK, } @@ -59,7 +59,7 @@ pub enum Op15GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op16GetResponse { - /// OK + /// OK () Status200_OK, } @@ -67,7 +67,7 @@ pub enum Op16GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op17GetResponse { - /// OK + /// OK () Status200_OK, } @@ -75,7 +75,7 @@ pub enum Op17GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op18GetResponse { - /// OK + /// OK () Status200_OK, } @@ -83,7 +83,7 @@ pub enum Op18GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op19GetResponse { - /// OK + /// OK () Status200_OK, } @@ -91,7 +91,7 @@ pub enum Op19GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op1GetResponse { - /// OK + /// OK () Status200_OK, } @@ -99,7 +99,7 @@ pub enum Op1GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op20GetResponse { - /// OK + /// OK () Status200_OK, } @@ -107,7 +107,7 @@ pub enum Op20GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op21GetResponse { - /// OK + /// OK () Status200_OK, } @@ -115,7 +115,7 @@ pub enum Op21GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op22GetResponse { - /// OK + /// OK () Status200_OK, } @@ -123,7 +123,7 @@ pub enum Op22GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op23GetResponse { - /// OK + /// OK () Status200_OK, } @@ -131,7 +131,7 @@ pub enum Op23GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op24GetResponse { - /// OK + /// OK () Status200_OK, } @@ -139,7 +139,7 @@ pub enum Op24GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op25GetResponse { - /// OK + /// OK () Status200_OK, } @@ -147,7 +147,7 @@ pub enum Op25GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op26GetResponse { - /// OK + /// OK () Status200_OK, } @@ -155,7 +155,7 @@ pub enum Op26GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op27GetResponse { - /// OK + /// OK () Status200_OK, } @@ -163,7 +163,7 @@ pub enum Op27GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op28GetResponse { - /// OK + /// OK () Status200_OK, } @@ -171,7 +171,7 @@ pub enum Op28GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op29GetResponse { - /// OK + /// OK () Status200_OK, } @@ -179,7 +179,7 @@ pub enum Op29GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op2GetResponse { - /// OK + /// OK () Status200_OK, } @@ -187,7 +187,7 @@ pub enum Op2GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op30GetResponse { - /// OK + /// OK () Status200_OK, } @@ -195,7 +195,7 @@ pub enum Op30GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op31GetResponse { - /// OK + /// OK () Status200_OK, } @@ -203,7 +203,7 @@ pub enum Op31GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op32GetResponse { - /// OK + /// OK () Status200_OK, } @@ -211,7 +211,7 @@ pub enum Op32GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op33GetResponse { - /// OK + /// OK () Status200_OK, } @@ -219,7 +219,7 @@ pub enum Op33GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op34GetResponse { - /// OK + /// OK () Status200_OK, } @@ -227,7 +227,7 @@ pub enum Op34GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op35GetResponse { - /// OK + /// OK () Status200_OK, } @@ -235,7 +235,7 @@ pub enum Op35GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op36GetResponse { - /// OK + /// OK () Status200_OK, } @@ -243,7 +243,7 @@ pub enum Op36GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op37GetResponse { - /// OK + /// OK () Status200_OK, } @@ -251,7 +251,7 @@ pub enum Op37GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op3GetResponse { - /// OK + /// OK () Status200_OK, } @@ -259,7 +259,7 @@ pub enum Op3GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op4GetResponse { - /// OK + /// OK () Status200_OK, } @@ -267,7 +267,7 @@ pub enum Op4GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op5GetResponse { - /// OK + /// OK () Status200_OK, } @@ -275,7 +275,7 @@ pub enum Op5GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op6GetResponse { - /// OK + /// OK () Status200_OK, } @@ -283,7 +283,7 @@ pub enum Op6GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op7GetResponse { - /// OK + /// OK () Status200_OK, } @@ -291,7 +291,7 @@ pub enum Op7GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op8GetResponse { - /// OK + /// OK () Status200_OK, } @@ -299,7 +299,7 @@ pub enum Op8GetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum Op9GetResponse { - /// OK + /// OK () Status200_OK, } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index 111e81d65823..7c50b914f456 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -32,6 +32,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md index e23826c249ce..bb183147dc25 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs index 3909f91949fa..f9023746c178 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/another_fake.rs @@ -11,8 +11,8 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestSpecialTagsResponse { - /// successful operation - Status200_SuccessfulOperation(models::Client), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Client), } /// AnotherFake diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs index 628096aba506..face568a9519 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum Call123exampleResponse { - /// success + /// success () Status200_Success, } @@ -19,39 +19,39 @@ pub enum Call123exampleResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FakeOuterBooleanSerializeResponse { - /// Output boolean - Status200_OutputBoolean(bool), + /// Output boolean (*/*) + Status200_OutputBoolean_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum FakeOuterCompositeSerializeResponse { - /// Output composite - Status200_OutputComposite(models::OuterComposite), + /// Output composite (*/*) + Status200_OutputComposite_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum FakeOuterNumberSerializeResponse { - /// Output number - Status200_OutputNumber(f64), + /// Output number (*/*) + Status200_OutputNumber_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum FakeOuterStringSerializeResponse { - /// Output string - Status200_OutputString(String), + /// Output string (*/*) + Status200_OutputString_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum FakeResponseWithNumericalDescriptionResponse { - /// 1234 + /// 1234 () Status200, } @@ -59,7 +59,7 @@ pub enum FakeResponseWithNumericalDescriptionResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum HyphenParamResponse { - /// Success + /// Success () Status200_Success, } @@ -67,7 +67,7 @@ pub enum HyphenParamResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestBodyWithQueryParamsResponse { - /// Success + /// Success () Status200_Success, } @@ -75,17 +75,17 @@ pub enum TestBodyWithQueryParamsResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestClientModelResponse { - /// successful operation - Status200_SuccessfulOperation(models::Client), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Client), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestEndpointParametersResponse { - /// Invalid username supplied + /// Invalid username supplied () Status400_InvalidUsernameSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } @@ -93,9 +93,9 @@ pub enum TestEndpointParametersResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestEnumParametersResponse { - /// Invalid request + /// Invalid request () Status400_InvalidRequest, - /// Not found + /// Not found () Status404_NotFound, } @@ -103,7 +103,7 @@ pub enum TestEnumParametersResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestInlineAdditionalPropertiesResponse { - /// successful operation + /// successful operation () Status200_SuccessfulOperation, } @@ -111,7 +111,7 @@ pub enum TestInlineAdditionalPropertiesResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestJsonFormDataResponse { - /// successful operation + /// successful operation () Status200_SuccessfulOperation, } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs index ee2b23e6f874..0072fcd2ea24 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/fake_classname_tags123.rs @@ -11,8 +11,8 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum TestClassnameResponse { - /// successful operation - Status200_SuccessfulOperation(models::Client), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Client), } /// FakeClassnameTags123 diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs index 713ccf267e02..c6f3e3b3a8e8 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/pet.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum AddPetResponse { - /// Invalid input + /// Invalid input () Status405_InvalidInput, } @@ -19,7 +19,7 @@ pub enum AddPetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeletePetResponse { - /// Invalid pet value + /// Invalid pet value () Status400_InvalidPetValue, } @@ -27,9 +27,11 @@ pub enum DeletePetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FindPetsByStatusResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid status value + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(Vec), + /// Invalid status value () Status400_InvalidStatusValue, } @@ -37,9 +39,11 @@ pub enum FindPetsByStatusResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FindPetsByTagsResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid tag value + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(Vec), + /// Invalid tag value () Status400_InvalidTagValue, } @@ -47,11 +51,13 @@ pub enum FindPetsByTagsResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPetByIdResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid ID supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Pet), + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Pet not found + /// Pet not found () Status404_PetNotFound, } @@ -59,11 +65,11 @@ pub enum GetPetByIdResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdatePetResponse { - /// Invalid ID supplied + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Pet not found + /// Pet not found () Status404_PetNotFound, - /// Validation exception + /// Validation exception () Status405_ValidationException, } @@ -71,7 +77,7 @@ pub enum UpdatePetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdatePetWithFormResponse { - /// Invalid input + /// Invalid input () Status405_InvalidInput, } @@ -79,8 +85,8 @@ pub enum UpdatePetWithFormResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UploadFileResponse { - /// successful operation - Status200_SuccessfulOperation(models::ApiResponse), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::ApiResponse), } /// Pet diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs index 4027411aabcb..938d58b437cb 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/store.rs @@ -11,9 +11,9 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeleteOrderResponse { - /// Invalid ID supplied + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Order not found + /// Order not found () Status404_OrderNotFound, } @@ -21,19 +21,21 @@ pub enum DeleteOrderResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetInventoryResponse { - /// successful operation - Status200_SuccessfulOperation(std::collections::HashMap), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(std::collections::HashMap), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetOrderByIdResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid ID supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Order), + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Order not found + /// Order not found () Status404_OrderNotFound, } @@ -41,9 +43,11 @@ pub enum GetOrderByIdResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum PlaceOrderResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid Order + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Order), + /// Invalid Order () Status400_InvalidOrder, } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs index 6e0d65737430..ade69d285944 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/apis/user.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUserResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -19,7 +19,7 @@ pub enum CreateUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUsersWithArrayInputResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -27,7 +27,7 @@ pub enum CreateUsersWithArrayInputResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUsersWithListInputResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -35,9 +35,9 @@ pub enum CreateUsersWithListInputResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeleteUserResponse { - /// Invalid username supplied + /// Invalid username supplied () Status400_InvalidUsernameSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } @@ -45,11 +45,13 @@ pub enum DeleteUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetUserByNameResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid username supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::User), + /// Invalid username supplied () Status400_InvalidUsernameSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } @@ -57,13 +59,19 @@ pub enum GetUserByNameResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum LoginUserResponse { - /// successful operation - Status200_SuccessfulOperation { + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText { body: String, x_rate_limit: Option, x_expires_after: Option>, }, - /// Invalid username/password supplied + /// successful operation (application/json) + Status200_SuccessfulOperation_Json { + body: String, + x_rate_limit: Option, + x_expires_after: Option>, + }, + /// Invalid username/password supplied () Status400_InvalidUsername, } @@ -71,7 +79,7 @@ pub enum LoginUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum LogoutUserResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -79,9 +87,9 @@ pub enum LogoutUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdateUserResponse { - /// Invalid user supplied + /// Invalid user supplied () Status400_InvalidUserSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } diff --git a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs index 18ac8a328821..1fec3af66184 100644 --- a/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/petstore-with-fake-endpoints-models-for-testing/src/server/mod.rs @@ -179,16 +179,18 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::another_fake::TestSpecialTagsResponse::Status200_SuccessfulOperation(body) => { + apis::another_fake::TestSpecialTagsResponse::Status200_SuccessfulOperation_Json( + body, + ) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -327,21 +329,15 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::fake::FakeOuterBooleanSerializeResponse::Status200_OutputBoolean(body) => { + apis::fake::FakeOuterBooleanSerializeResponse::Status200_OutputBoolean_PlainText( + body, + ) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; + let body_content = body; response.body(Body::from(body_content)) } }, @@ -414,34 +410,27 @@ where let mut response = Response::builder(); let resp = match result { - Ok(rsp) => match rsp { - apis::fake::FakeOuterCompositeSerializeResponse::Status200_OutputComposite(body) => { - let mut response = response.status(200); - { - let mut response_headers = response.headers_mut().unwrap(); - response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); - } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; - response.body(Body::from(body_content)) - } - }, - Err(why) => { - // Application code returned an error. This should not happen, as the implementation should - // return a valid response. - return api_impl - .as_ref() - .handle_error(&method, &host, &cookies, why) - .await; - } - }; + Ok(rsp) => match rsp { + apis::fake::FakeOuterCompositeSerializeResponse::Status200_OutputComposite_PlainText + (body) + => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers.insert( + CONTENT_TYPE, + HeaderValue::from_static("*/*")); + } + let body_content = body; + response.body(Body::from(body_content)) + }, + }, + Err(why) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + return api_impl.as_ref().handle_error(&method, &host, &cookies, why).await; + }, + }; resp.map_err(|e| { error!(error = ?e); @@ -503,21 +492,15 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::fake::FakeOuterNumberSerializeResponse::Status200_OutputNumber(body) => { + apis::fake::FakeOuterNumberSerializeResponse::Status200_OutputNumber_PlainText( + body, + ) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; + let body_content = body; response.body(Body::from(body_content)) } }, @@ -591,21 +574,15 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::fake::FakeOuterStringSerializeResponse::Status200_OutputString(body) => { + apis::fake::FakeOuterStringSerializeResponse::Status200_OutputString_PlainText( + body, + ) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; + let body_content = body; response.body(Body::from(body_content)) } }, @@ -879,16 +856,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::fake::TestClientModelResponse::Status200_SuccessfulOperation(body) => { + apis::fake::TestClientModelResponse::Status200_SuccessfulOperation_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -1343,37 +1320,32 @@ where let mut response = Response::builder(); let resp = match result { - Ok(rsp) => match rsp { - apis::fake_classname_tags123::TestClassnameResponse::Status200_SuccessfulOperation( - body, - ) => { - let mut response = response.status(200); - { - let mut response_headers = response.headers_mut().unwrap(); - response_headers - .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); - } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; - response.body(Body::from(body_content)) - } - }, - Err(why) => { - // Application code returned an error. This should not happen, as the implementation should - // return a valid response. - return api_impl - .as_ref() - .handle_error(&method, &host, &cookies, why) - .await; - } - }; + Ok(rsp) => match rsp { + apis::fake_classname_tags123::TestClassnameResponse::Status200_SuccessfulOperation_Json + (body) + => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers.insert( + CONTENT_TYPE, + HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + })).await.unwrap()?; + response.body(Body::from(body_content)) + }, + }, + Err(why) => { + // Application code returned an error. This should not happen, as the implementation should + // return a valid response. + return api_impl.as_ref().handle_error(&method, &host, &cookies, why).await; + }, + }; resp.map_err(|e| { error!(error = ?e); @@ -1591,16 +1563,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => { + apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::FindPetsByStatusResponse::Status400_InvalidStatusValue => { let mut response = response.status(400); response.body(Body::empty()) @@ -1666,16 +1655,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => { + apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::FindPetsByTagsResponse::Status400_InvalidTagValue => { let mut response = response.status(400); response.body(Body::empty()) @@ -1751,16 +1757,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation(body) => { + apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::GetPetByIdResponse::Status400_InvalidIDSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -1994,16 +2017,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::UploadFileResponse::Status200_SuccessfulOperation(body) => { + apis::pet::UploadFileResponse::Status200_SuccessfulOperation_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -2146,16 +2169,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::GetInventoryResponse::Status200_SuccessfulOperation(body) => { + apis::store::GetInventoryResponse::Status200_SuccessfulOperation_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -2224,16 +2247,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation(body) => { + apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::store::GetOrderByIdResponse::Status400_InvalidIDSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -2310,16 +2350,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::PlaceOrderResponse::Status200_SuccessfulOperation(body) => { + apis::store::PlaceOrderResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::store::PlaceOrderResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::store::PlaceOrderResponse::Status400_InvalidOrder => { let mut response = response.status(400); response.body(Body::empty()) @@ -2670,16 +2727,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::user::GetUserByNameResponse::Status200_SuccessfulOperation(body) => { + apis::user::GetUserByNameResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::user::GetUserByNameResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::user::GetUserByNameResponse::Status400_InvalidUsernameSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -2748,7 +2822,7 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::user::LoginUserResponse::Status200_SuccessfulOperation { + apis::user::LoginUserResponse::Status200_SuccessfulOperation_PlainText { body, x_rate_limit, x_expires_after, @@ -2791,10 +2865,64 @@ where let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::user::LoginUserResponse::Status200_SuccessfulOperation_Json { + body, + x_rate_limit, + x_expires_after, + } => { + if let Some(x_rate_limit) = x_rate_limit { + let x_rate_limit = match header::IntoHeaderValue(x_rate_limit).try_into() { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_rate_limit header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(HeaderName::from_static("x-rate-limit"), x_rate_limit); + } + } + if let Some(x_expires_after) = x_expires_after { + let x_expires_after = match header::IntoHeaderValue(x_expires_after).try_into() + { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_expires_after header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(HeaderName::from_static("x-expires-after"), x_expires_after); + } + } + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::user::LoginUserResponse::Status400_InvalidUsername => { let mut response = response.status(400); response.body(Body::empty()) diff --git a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/petstore/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/Cargo.toml b/samples/server/petstore/rust-axum/output/petstore/Cargo.toml index 75607ff75963..cf9af1878641 100644 --- a/samples/server/petstore/rust-axum/output/petstore/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/petstore/Cargo.toml @@ -31,6 +31,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/petstore/README.md b/samples/server/petstore/rust-axum/output/petstore/README.md index cc6bd02a32bf..707a96f79780 100644 --- a/samples/server/petstore/rust-axum/output/petstore/README.md +++ b/samples/server/petstore/rust-axum/output/petstore/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0.0 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs index e198cf1fffe1..2b08af881ec6 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/pet.rs @@ -11,9 +11,11 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum AddPetResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid input + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Pet), + /// Invalid input () Status405_InvalidInput, } @@ -21,7 +23,7 @@ pub enum AddPetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeletePetResponse { - /// Invalid pet value + /// Invalid pet value () Status400_InvalidPetValue, } @@ -29,9 +31,11 @@ pub enum DeletePetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FindPetsByStatusResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid status value + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(Vec), + /// Invalid status value () Status400_InvalidStatusValue, } @@ -39,9 +43,11 @@ pub enum FindPetsByStatusResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FindPetsByTagsResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid tag value + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(Vec), + /// Invalid tag value () Status400_InvalidTagValue, } @@ -49,11 +55,13 @@ pub enum FindPetsByTagsResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetPetByIdResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid ID supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Pet), + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Pet not found + /// Pet not found () Status404_PetNotFound, } @@ -61,13 +69,15 @@ pub enum GetPetByIdResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdatePetResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid ID supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Pet), + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Pet not found + /// Pet not found () Status404_PetNotFound, - /// Validation exception + /// Validation exception () Status405_ValidationException, } @@ -75,7 +85,7 @@ pub enum UpdatePetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdatePetWithFormResponse { - /// Invalid input + /// Invalid input () Status405_InvalidInput, } @@ -83,8 +93,8 @@ pub enum UpdatePetWithFormResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UploadFileResponse { - /// successful operation - Status200_SuccessfulOperation(models::ApiResponse), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::ApiResponse), } /// Pet diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs index a4b3b99459cf..36b1dead7f87 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/store.rs @@ -11,9 +11,9 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeleteOrderResponse { - /// Invalid ID supplied + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Order not found + /// Order not found () Status404_OrderNotFound, } @@ -21,19 +21,21 @@ pub enum DeleteOrderResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetInventoryResponse { - /// successful operation - Status200_SuccessfulOperation(std::collections::HashMap), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(std::collections::HashMap), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetOrderByIdResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid ID supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Order), + /// Invalid ID supplied () Status400_InvalidIDSupplied, - /// Order not found + /// Order not found () Status404_OrderNotFound, } @@ -41,9 +43,11 @@ pub enum GetOrderByIdResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum PlaceOrderResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid Order + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::Order), + /// Invalid Order () Status400_InvalidOrder, } diff --git a/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs b/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs index fb120849ce8c..82e1135caa29 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/apis/user.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUserResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -19,7 +19,7 @@ pub enum CreateUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUsersWithArrayInputResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -27,7 +27,7 @@ pub enum CreateUsersWithArrayInputResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum CreateUsersWithListInputResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -35,9 +35,9 @@ pub enum CreateUsersWithListInputResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum DeleteUserResponse { - /// Invalid username supplied + /// Invalid username supplied () Status400_InvalidUsernameSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } @@ -45,11 +45,13 @@ pub enum DeleteUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetUserByNameResponse { - /// successful operation - Status200_SuccessfulOperation(String), - /// Invalid username supplied + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText(String), + /// successful operation (application/json) + Status200_SuccessfulOperation_Json(models::User), + /// Invalid username supplied () Status400_InvalidUsernameSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } @@ -57,14 +59,21 @@ pub enum GetUserByNameResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum LoginUserResponse { - /// successful operation - Status200_SuccessfulOperation { + /// successful operation (application/xml) + Status200_SuccessfulOperation_PlainText { body: String, set_cookie: Option, x_rate_limit: Option, x_expires_after: Option>, }, - /// Invalid username/password supplied + /// successful operation (application/json) + Status200_SuccessfulOperation_Json { + body: String, + set_cookie: Option, + x_rate_limit: Option, + x_expires_after: Option>, + }, + /// Invalid username/password supplied () Status400_InvalidUsername, } @@ -72,7 +81,7 @@ pub enum LoginUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum LogoutUserResponse { - /// successful operation + /// successful operation () Status0_SuccessfulOperation, } @@ -80,9 +89,9 @@ pub enum LogoutUserResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum UpdateUserResponse { - /// Invalid user supplied + /// Invalid user supplied () Status400_InvalidUserSupplied, - /// User not found + /// User not found () Status404_UserNotFound, } diff --git a/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs b/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs index cd65b69be6a1..fc22a23b766c 100644 --- a/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/petstore/src/server/mod.rs @@ -122,16 +122,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::AddPetResponse::Status200_SuccessfulOperation(body) => { + apis::pet::AddPetResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::AddPetResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::AddPetResponse::Status405_InvalidInput => { let mut response = response.status(405); response.body(Body::empty()) @@ -293,16 +310,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation(body) => { + apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::FindPetsByStatusResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::FindPetsByStatusResponse::Status400_InvalidStatusValue => { let mut response = response.status(400); response.body(Body::empty()) @@ -368,16 +402,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation(body) => { + apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::FindPetsByTagsResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::FindPetsByTagsResponse::Status400_InvalidTagValue => { let mut response = response.status(400); response.body(Body::empty()) @@ -453,16 +504,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation(body) => { + apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::GetPetByIdResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::GetPetByIdResponse::Status400_InvalidIDSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -539,16 +607,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::UpdatePetResponse::Status200_SuccessfulOperation(body) => { + apis::pet::UpdatePetResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::pet::UpdatePetResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::pet::UpdatePetResponse::Status400_InvalidIDSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -706,16 +791,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::pet::UploadFileResponse::Status200_SuccessfulOperation(body) => { + apis::pet::UploadFileResponse::Status200_SuccessfulOperation_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -858,16 +943,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::GetInventoryResponse::Status200_SuccessfulOperation(body) => { + apis::store::GetInventoryResponse::Status200_SuccessfulOperation_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -936,16 +1021,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation(body) => { + apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::store::GetOrderByIdResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::store::GetOrderByIdResponse::Status400_InvalidIDSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -1022,16 +1124,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::store::PlaceOrderResponse::Status200_SuccessfulOperation(body) => { + apis::store::PlaceOrderResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::store::PlaceOrderResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::store::PlaceOrderResponse::Status400_InvalidOrder => { let mut response = response.status(400); response.body(Body::empty()) @@ -1426,16 +1545,33 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::user::GetUserByNameResponse::Status200_SuccessfulOperation(body) => { + apis::user::GetUserByNameResponse::Status200_SuccessfulOperation_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::user::GetUserByNameResponse::Status200_SuccessfulOperation_Json(body) => { + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::user::GetUserByNameResponse::Status400_InvalidUsernameSupplied => { let mut response = response.status(400); response.body(Body::empty()) @@ -1504,7 +1640,7 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::user::LoginUserResponse::Status200_SuccessfulOperation { + apis::user::LoginUserResponse::Status200_SuccessfulOperation_PlainText { body, set_cookie, x_rate_limit, @@ -1563,10 +1699,80 @@ where let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/plain")); } - let body_content = body; response.body(Body::from(body_content)) } + apis::user::LoginUserResponse::Status200_SuccessfulOperation_Json { + body, + set_cookie, + x_rate_limit, + x_expires_after, + } => { + if let Some(set_cookie) = set_cookie { + let set_cookie = match header::IntoHeaderValue(set_cookie).try_into() { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling set_cookie header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers.insert(HeaderName::from_static("set-cookie"), set_cookie); + } + } + if let Some(x_rate_limit) = x_rate_limit { + let x_rate_limit = match header::IntoHeaderValue(x_rate_limit).try_into() { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_rate_limit header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(HeaderName::from_static("x-rate-limit"), x_rate_limit); + } + } + if let Some(x_expires_after) = x_expires_after { + let x_expires_after = match header::IntoHeaderValue(x_expires_after).try_into() + { + Ok(val) => val, + Err(e) => { + return Response::builder() + .status(StatusCode::INTERNAL_SERVER_ERROR) + .body(Body::from(format!("An internal server error occurred handling x_expires_after header - {e}"))).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }); + } + }; + + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(HeaderName::from_static("x-expires-after"), x_expires_after); + } + } + let mut response = response.status(200); + { + let mut response_headers = response.headers_mut().unwrap(); + response_headers + .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); + } + let body_clone = body.clone(); + let body_content = tokio::task::spawn_blocking(move || { + serde_json::to_vec(&body_clone).map_err(|e| { + error!(error = ?e); + StatusCode::INTERNAL_SERVER_ERROR + }) + }) + .await + .unwrap()?; + response.body(Body::from(body_content)) + } apis::user::LoginUserResponse::Status400_InvalidUsername => { let mut response = response.status(400); response.body(Body::empty()) diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/Cargo.toml b/samples/server/petstore/rust-axum/output/ping-bearer-auth/Cargo.toml index d89007acc726..857fe5d61663 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md index c713cda26bc5..c8f6452650ea 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 1.0 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs index 3c050b37a413..1fb14b137127 100644 --- a/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/ping-bearer-auth/src/apis/default.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum PingGetResponse { - /// OK + /// OK () Status201_OK, } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/Cargo.toml index 64fff80aef2e..1a0c11aa74a4 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/README.md index b1daa56d2986..6e2df5207183 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/src/apis/default.rs index 7d6df7c3c3a8..0b6e2ff57271 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-array-params-test/src/apis/default.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum EndpointGetResponse { - /// OK. + /// OK. () Status200_OK, } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml index ae19725687b0..61a21195d4d8 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md index 6cf3c91bbfe6..d4b877b8ff7d 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.1.9 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs index dc6c4a3664ea..7c539c5a8f4d 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/apis/default.rs @@ -11,8 +11,8 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum UsersPostResponse { - /// Added row to table! - Status201_AddedRowToTable(String), + /// Added row to table! (application/json) + Status201_AddedRowToTable_Json(String), } /// Default diff --git a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs index 91e28a249687..6cf664bda3ec 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-header-uuid/src/server/mod.rs @@ -101,16 +101,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::UsersPostResponse::Status201_AddedRowToTable(body) => { + apis::default::UsersPostResponse::Status201_AddedRowToTable_Json(body) => { let mut response = response.status(201); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) diff --git a/samples/server/petstore/rust-axum/output/rust-axum-oneof/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-oneof/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-oneof/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-oneof/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-oneof/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-oneof/Cargo.toml index 7f53563aedb0..489b662b4c0e 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-oneof/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/rust-axum-oneof/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-oneof/README.md b/samples/server/petstore/rust-axum/output/rust-axum-oneof/README.md index fbd4443d7366..8a7f519d2001 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-oneof/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-oneof/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/apis/default.rs index 7f9dff64a5bd..1d1cd5501f7d 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/apis/default.rs @@ -11,8 +11,8 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum FooResponse { - /// Re-serialize and echo the request data - Status200_Re(models::Message), + /// Re-serialize and echo the request data (application/json) + Status200_Re_Json(models::Message), } /// Default diff --git a/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/server/mod.rs b/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/server/mod.rs index d65aaeb76aaf..487eed7bee31 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-oneof/src/server/mod.rs @@ -73,16 +73,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::FooResponse::Status200_Re(body) => { + apis::default::FooResponse::Status200_Re_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-test/Cargo.toml index 34d2ef981a4c..fefdd985c083 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md index f0f4d6f5b6a1..beff24b3654d 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 2.3.4 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs index 08660f91101c..9ad455a97313 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/src/apis/default.rs @@ -11,15 +11,15 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum AllOfGetResponse { - /// OK - Status200_OK(models::FooAllOfObject), + /// OK (*/*) + Status200_OK_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum DummyGetResponse { - /// Success + /// Success () Status200_Success, } @@ -27,7 +27,7 @@ pub enum DummyGetResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum DummyPutResponse { - /// Success + /// Success () Status200_Success, } @@ -35,31 +35,31 @@ pub enum DummyPutResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum FileResponseGetResponse { - /// Success - Status200_Success(ByteArray), + /// Success (application/json) + Status200_Success_Json(ByteArray), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum GetStructuredYamlResponse { - /// OK - Status200_OK(String), + /// OK (application/yaml) + Status200_OK_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum HtmlPostResponse { - /// Success - Status200_Success(String), + /// Success (text/html) + Status200_Success_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum PostYamlResponse { - /// OK + /// OK () Status204_OK, } @@ -67,15 +67,15 @@ pub enum PostYamlResponse { #[must_use] #[allow(clippy::large_enum_variant)] pub enum RawJsonGetResponse { - /// Success - Status200_Success(crate::types::Object), + /// Success (*/*) + Status200_Success_PlainText(String), } #[derive(Debug, PartialEq, Serialize, Deserialize)] #[must_use] #[allow(clippy::large_enum_variant)] pub enum SoloObjectPostResponse { - /// OK + /// OK () Status204_OK, } diff --git a/samples/server/petstore/rust-axum/output/rust-axum-test/src/server/mod.rs b/samples/server/petstore/rust-axum/output/rust-axum-test/src/server/mod.rs index b0be9c78af8f..983fcd9a3a60 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-test/src/server/mod.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-test/src/server/mod.rs @@ -70,21 +70,13 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::AllOfGetResponse::Status200_OK(body) => { + apis::default::AllOfGetResponse::Status200_OK_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; + let body_content = body; response.body(Body::from(body_content)) } }, @@ -270,16 +262,16 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::FileResponseGetResponse::Status200_Success(body) => { + apis::default::FileResponseGetResponse::Status200_Success_Json(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/json")); } - + let body_clone = body.clone(); let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { + serde_json::to_vec(&body_clone).map_err(|e| { error!(error = ?e); StatusCode::INTERNAL_SERVER_ERROR }) @@ -343,14 +335,13 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::GetStructuredYamlResponse::Status200_OK(body) => { + apis::default::GetStructuredYamlResponse::Status200_OK_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers .insert(CONTENT_TYPE, HeaderValue::from_static("application/yaml")); } - let body_content = body; response.body(Body::from(body_content)) } @@ -416,13 +407,12 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::HtmlPostResponse::Status200_Success(body) => { + apis::default::HtmlPostResponse::Status200_Success_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("text/html")); } - let body_content = body; response.body(Body::from(body_content)) } @@ -547,21 +537,13 @@ where let resp = match result { Ok(rsp) => match rsp { - apis::default::RawJsonGetResponse::Status200_Success(body) => { + apis::default::RawJsonGetResponse::Status200_Success_PlainText(body) => { let mut response = response.status(200); { let mut response_headers = response.headers_mut().unwrap(); response_headers.insert(CONTENT_TYPE, HeaderValue::from_static("*/*")); } - - let body_content = tokio::task::spawn_blocking(move || { - serde_json::to_vec(&body).map_err(|e| { - error!(error = ?e); - StatusCode::INTERNAL_SERVER_ERROR - }) - }) - .await - .unwrap()?; + let body_content = body; response.body(Body::from(body_content)) } }, diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION index 5e5282953086..9e0e9bce84b2 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/.openapi-generator/VERSION @@ -1 +1 @@ -7.16.0-SNAPSHOT +7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml index 9186b14edd0e..359fda397aa7 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/Cargo.toml @@ -30,6 +30,7 @@ frunk-enum-core = { version = "0.3", optional = true } frunk-enum-derive = { version = "0.3", optional = true } frunk_core = { version = "0.4", optional = true } frunk_derives = { version = "0.4", optional = true } +futures = "0.3.31" http = "1" lazy_static = "1" regex = "1" diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md index b2888b49b37b..65d42f5020a3 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/README.md @@ -12,7 +12,7 @@ server, you can easily generate a server stub. To see how to make this your own, look here: [README]((https://openapi-generator.tech)) - API version: 0.0.1 -- Generator version: 7.16.0-SNAPSHOT +- Generator version: 7.17.0-SNAPSHOT diff --git a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs index 35fd5a37d51f..5c2c8f48d158 100644 --- a/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs +++ b/samples/server/petstore/rust-axum/output/rust-axum-validation-test/src/apis/default.rs @@ -11,7 +11,7 @@ use crate::{models, types::*}; #[must_use] #[allow(clippy::large_enum_variant)] pub enum MailPutResponse { - /// OK. + /// OK. () Status204_OK, }