Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/samples-rust-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,22 @@ jobs:
run: |
set -e

# Iterate through each example and test various features
for package in $(find . -maxdepth 1 -mindepth 1 -type d)
# Iterate through each package and test various features
for package in $(find output -maxdepth 1 -mindepth 1 -type d)
do
pushd $package
# Not all versions have a server example
if test -f examples/server/main.rs; then
cargo build --example server --features="server"
cargo build --example ${package##*/}-server --features="server"
fi
# Not all versions have a client example
if test -f examples/client/main.rs; then
cargo build --example ${package##*/}-client --features="client"
fi
# Test the CLI works if present
if test -f bin/cli.rs; then
cargo build --bin ${package##*/} --features cli
target/debug/${package##*/} --help
../../target/debug/${package##*/} --help
fi
# Test the validate feature if it exists
if cargo read-manifest | grep -q '"validate"'; then
Expand All @@ -77,4 +82,5 @@ jobs:
cargo test
cargo clippy
cargo doc
popd
done
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,13 @@ tokio-openssl = "0.6"
openssl = "0.10"

[[example]]
name = "client"
name = "{{{packageName}}}-client"
path = "examples/client/main.rs"
required-features = ["client"]

[[example]]
name = "server"
name = "{{{packageName}}}-server"
path = "examples/server/main.rs"
required-features = ["server"]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ You'll find the binary at `target/release/cli`.
Run examples with:

```
cargo run --example <example-name>
cargo run --example {{{packageName}}}-<client|server>
```

To pass in arguments to the examples, put them after `--`, for example:

```
cargo run --example client -- --help
cargo run --example {{{packageName}}}-client -- --help
```

### Running the example server
To run the server, follow these simple steps:

```
cargo run --example server
cargo run --example {{{packageName}}}-server
```

### Running the example client
Expand All @@ -97,7 +97,7 @@ To run a client, follow one of the following simple steps:
{{#operation}}
{{#vendorExtensions}}
{{^x-no-client-example}}
cargo run --example client {{{operationId}}}
cargo run --example {{{packageName}}}-client {{{operationId}}}
{{/x-no-client-example}}
{{/vendorExtensions}}
{{/operation}}
Expand All @@ -110,7 +110,7 @@ cargo run --example client {{{operationId}}}
The examples can be run in HTTPS mode by passing in the flag `--https`, for example:

```
cargo run --example server -- --https
cargo run --example {{{packageName}}}-server -- --https
```

This will use the keys/certificates from the examples directory. Note that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Enabling client-side Vec header parsing is broken because the parser splits on commas, but struct header serialization/deserialization already uses comma-separated key/value pairs. Any Vec of struct headers will fail to parse at runtime for clients.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/resources/rust-server-deprecated/models.mustache, line 582:

<comment>Enabling client-side Vec<Struct> header parsing is broken because the parser splits on commas, but struct header serialization/deserialization already uses comma-separated key/value pairs. Any Vec of struct headers will fail to parse at runtime for clients.</comment>

<file context>
@@ -579,7 +579,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
 }
 
-#[cfg(feature = "server")]
+#[cfg(any(feature = "client", feature = "server"))]
 impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hyper::header::HeaderValue {
     type Error = String;
</file context>
Fix with Cubic

impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hyper::header::HeaderValue {
type Error = String;
Expand All @@ -595,7 +595,7 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hy
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<{{{classname}}}>> {
type Error = String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,13 @@ openssl = "0.10"
tokio-openssl = "0.6"

[[example]]
name = "client"
name = "{{{packageName}}}-client"
path = "examples/client/main.rs"
required-features = ["client"]

[[example]]
name = "server"
name = "{{{packageName}}}-server"
path = "examples/server/main.rs"
required-features = ["server"]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ You'll find the binary at `target/release/cli`.
Run examples with:

```
cargo run --example <example-name>
cargo run --example {{{packageName}}}-<client|server>
```

To pass in arguments to the examples, put them after `--`, for example:

```
cargo run --example client -- --help
cargo run --example {{{packageName}}}-client -- --help
```

### Running the example server
To run the server, follow these simple steps:

```
cargo run --example server
cargo run --example {{{packageName}}}-server
```

### Running the example client
Expand All @@ -97,7 +97,7 @@ To run a client, follow one of the following simple steps:
{{#operation}}
{{#exts}}
{{^x-no-client-example}}
cargo run --example client {{{operationId}}}
cargo run --example {{{packageName}}}-client {{{operationId}}}
{{/x-no-client-example}}
{{/exts}}
{{/operation}}
Expand All @@ -110,7 +110,7 @@ cargo run --example client {{{operationId}}}
The examples can be run in HTTPS mode by passing in the flag `--https`, for example:

```
cargo run --example server -- --https
cargo run --example {{{packageName}}}-server -- --https
```

This will use the keys/certificates from the examples directory. Note that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hyper::header::HeaderValue {
type Error = String;

Expand All @@ -645,15 +645,15 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<{{{classname}}}>>> for hy
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<{{{classname}}}>> {
type Error = String;

fn try_from(hdr_values: hyper::header::HeaderValue) -> std::result::Result<Self, Self::Error> {
match hdr_values.to_str() {
std::result::Result::Ok(hdr_values) => {
let hdr_values : std::vec::Vec<{{{classname}}}> = hdr_values
.split(',')
.split(",")
.filter_map(|hdr_value| match hdr_value.trim() {
"" => std::option::Option::None,
hdr_value => std::option::Option::Some({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,13 @@ tokio-openssl = "0.6"
openssl = "0.10"

[[example]]
name = "client"
name = "multipart-v3-client"
path = "examples/client/main.rs"
required-features = ["client"]

[[example]]
name = "server"
name = "multipart-v3-server"
path = "examples/server/main.rs"
required-features = ["server"]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,36 +66,36 @@ You'll find the binary at `target/release/cli`.
Run examples with:

```
cargo run --example <example-name>
cargo run --example multipart-v3-<client|server>
```

To pass in arguments to the examples, put them after `--`, for example:

```
cargo run --example client -- --help
cargo run --example multipart-v3-client -- --help
```

### Running the example server
To run the server, follow these simple steps:

```
cargo run --example server
cargo run --example multipart-v3-server
```

### Running the example client
To run a client, follow one of the following simple steps:

```
cargo run --example client MultipartRelatedRequestPost
cargo run --example client MultipartRequestPost
cargo run --example client MultipleIdenticalMimeTypesPost
cargo run --example multipart-v3-client MultipartRelatedRequestPost
cargo run --example multipart-v3-client MultipartRequestPost
cargo run --example multipart-v3-client MultipleIdenticalMimeTypesPost
```

### HTTPS
The examples can be run in HTTPS mode by passing in the flag `--https`, for example:

```
cargo run --example server -- --https
cargo run --example multipart-v3-server -- --https
```

This will use the keys/certificates from the examples directory. Note that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Enabling client support for Vec headers exposes a non-round‑trip serialization: items serialize using commas internally, but the Vec header logic joins/splits on commas, so parsing a serialized vector will mis-split items and fail.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/rust-server-deprecated/output/multipart-v3/src/models.rs, line 140:

<comment>Enabling client support for Vec<MultipartRequestObjectField> headers exposes a non-round‑trip serialization: items serialize using commas internally, but the Vec header logic joins/splits on commas, so parsing a serialized vector will mis-split items and fail.</comment>

<file context>
@@ -137,7 +137,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
 }
 
-#[cfg(feature = "server")]
+#[cfg(any(feature = "client", feature = "server"))]
 impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRelatedRequest>>> for hyper::header::HeaderValue {
     type Error = String;
</file context>
Fix with Cubic

impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRelatedRequest>>> for hyper::header::HeaderValue {
type Error = String;

Expand All @@ -153,7 +153,7 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRelatedRequest>>
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipartRelatedRequest>> {
type Error = String;

Expand Down Expand Up @@ -307,7 +307,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRequestObjectField>>> for hyper::header::HeaderValue {
type Error = String;

Expand All @@ -323,7 +323,7 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipartRequestObjectFie
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipartRequestObjectField>> {
type Error = String;

Expand Down Expand Up @@ -471,7 +471,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipleIdenticalMimeTypesPostRequest>>> for hyper::header::HeaderValue {
type Error = String;

Expand All @@ -487,7 +487,7 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<MultipleIdenticalMimeType
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<MultipleIdenticalMimeTypesPostRequest>> {
type Error = String;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ tokio-openssl = "0.6"
openssl = "0.10"

[[example]]
name = "client"
name = "no-example-v3-client"
path = "examples/client/main.rs"
required-features = ["client"]

[[example]]
name = "server"
name = "no-example-v3-server"
path = "examples/server/main.rs"
required-features = ["server"]

[[bin]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ You'll find the binary at `target/release/cli`.
Run examples with:

```
cargo run --example <example-name>
cargo run --example no-example-v3-<client|server>
```

To pass in arguments to the examples, put them after `--`, for example:

```
cargo run --example client -- --help
cargo run --example no-example-v3-client -- --help
```

### Running the example server
To run the server, follow these simple steps:

```
cargo run --example server
cargo run --example no-example-v3-server
```

### Running the example client
Expand All @@ -92,7 +92,7 @@ To run a client, follow one of the following simple steps:
The examples can be run in HTTPS mode by passing in the flag `--https`, for example:

```
cargo run --example server -- --https
cargo run --example no-example-v3-server -- --https
```

This will use the keys/certificates from the examples directory. Note that the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Enabling the Vec header parsing for the client feature exposes a parsing bug: the Vec deserializer splits on every comma, but each OpGetRequest uses commas internally (property,<value>). This fragments each element and causes OpGetRequest::from_str to error (“Missing value”), so multi-item headers fail to parse.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/rust-server-deprecated/output/no-example-v3/src/models.rs, line 123:

<comment>Enabling the Vec<OpGetRequest> header parsing for the client feature exposes a parsing bug: the Vec deserializer splits on every comma, but each OpGetRequest uses commas internally (`property,<value>`). This fragments each element and causes `OpGetRequest::from_str` to error (“Missing value”), so multi-item headers fail to parse.</comment>

<file context>
@@ -120,7 +120,7 @@ impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderVal
 }
 
-#[cfg(feature = "server")]
+#[cfg(any(feature = "client", feature = "server"))]
 impl std::convert::TryFrom<header::IntoHeaderValue<Vec<OpGetRequest>>> for hyper::header::HeaderValue {
     type Error = String;
</file context>
Fix with Cubic

impl std::convert::TryFrom<header::IntoHeaderValue<Vec<OpGetRequest>>> for hyper::header::HeaderValue {
type Error = String;

Expand All @@ -136,7 +136,7 @@ impl std::convert::TryFrom<header::IntoHeaderValue<Vec<OpGetRequest>>> for hyper
}
}

#[cfg(feature = "server")]
#[cfg(any(feature = "client", feature = "server"))]
impl std::convert::TryFrom<hyper::header::HeaderValue> for header::IntoHeaderValue<Vec<OpGetRequest>> {
type Error = String;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ tokio-openssl = "0.6"
openssl = "0.10"

[[example]]
name = "client"
name = "openapi-v3-client"
path = "examples/client/main.rs"
required-features = ["client"]

[[example]]
name = "server"
name = "openapi-v3-server"
path = "examples/server/main.rs"
required-features = ["server"]

[[bin]]
Expand Down
Loading
Loading