From c15a4375e2c41a646a8921df976cb71bea99d00b Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Sat, 30 Jan 2021 11:49:18 +0000 Subject: [PATCH] [Rust Server] Cargo Metadata Configuration (#8519) * [Rust Server] Support Cargo Metadata Configuration This adds support for publish, repository, documentation and homepage metadata. * [Rust Server] Test Cargo Metadata configuration --- ...store-with-fake-endpoints-models-for-testing.yaml | 1 + .../src/main/resources/rust-server/Cargo.mustache | 12 ++++++++++++ .../Cargo.toml | 1 + 3 files changed, 14 insertions(+) diff --git a/bin/configs/rust-server-petstore-with-fake-endpoints-models-for-testing.yaml b/bin/configs/rust-server-petstore-with-fake-endpoints-models-for-testing.yaml index c0f47a60634..7e009c7d952 100644 --- a/bin/configs/rust-server-petstore-with-fake-endpoints-models-for-testing.yaml +++ b/bin/configs/rust-server-petstore-with-fake-endpoints-models-for-testing.yaml @@ -6,3 +6,4 @@ generateAliasAsModel: true additionalProperties: hideGenerationTimestamp: "true" packageName: petstore-with-fake-endpoints-models-for-testing + publishRustRegistry: crates-io diff --git a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache index 4c733fbafe4..a822a900193 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/Cargo.mustache @@ -7,6 +7,18 @@ description = "{{{appDescription}}}" {{/appDescription}} license = "Unlicense" edition = "2018" +{{#publishRustRegistry}} +publish = ["{{publishRustRegistry}}"] +{{/publishRustRegistry}} +{{#repositoryUrl}} +repository = "{{repositoryUrl}}" +{{/repositoryUrl}} +{{#documentationUrl}} +documentation = "{{documentationUrl}}" +{{/documentationUrl}} +{{#homePageUrl}} +homepage = "{{homePageUrl}} +{{/homePageUrl}} [features] default = ["client", "server"] diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml index fb344637445..9c9a34f1aa4 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/Cargo.toml @@ -5,6 +5,7 @@ authors = [] description = "This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\" license = "Unlicense" edition = "2018" +publish = ["crates-io"] [features] default = ["client", "server"]