openapi-generator/bin/configs/manual/rust-axum-header-uuid.yaml
myz-dev 2d967ccae8
[Rust-Axum] Fix uuid in header params causing compilation errors (#18563)
* fix: Fix uuid in header params causing errors

Routes with header parameters with a `format` of `uuid` in the openAPI
specification used to cause a compilation error in the resulting
Rust Axum code.
This commit fixes the issue by including the correct conversion trait
implementation on the condition that at least one header parameter of
`format` `uuid` is included in the specification.

* refactor: Add final to boolean

* fix: Bring str::FromStr optionally into scope

The trait needs to be in scope for the TryFrom implementation:
`TryFrom<HeaderValue> for IntoHeaderValue<uuid::Uuid> `
It will only be brought into scope when the implementation is rendered.

* test: Add integration test and its specification

This commit adds an integration test that tests the bug fix for #18554.
A header parameter of `format: uuid` is included in one route.
This makes the example create a route handler that tries to extract a
Rust `uuid::Uuid` type from the header. The integration test will check
that the generated code compiles.

* test: Update examples and run integration test

The generated samples are updated with:
`./bin/generate-samples.sh ./bin/configs/manual/*.yaml`
Most example projects have their version numbers bumped. Some changes
show, that there are some other unrelated changes to the files, which
indicates that some prior commit did not update the samples accordingly.
The relevant integration test
`mvn integration-test -f samples/server/petstore/rust-axum/pom.xml`
passes.
2024-05-07 21:02:19 +08:00

10 lines
411 B
YAML

generatorName: rust-axum
outputDir: samples/server/petstore/rust-axum/output/rust-axum-header-uuid
inputSpec: modules/openapi-generator/src/test/resources/3_0/rust-axum/rust-axum-header-uuid.yaml
templateDir: modules/openapi-generator/src/main/resources/rust-axum
generateAliasAsModel: true
additionalProperties:
hideGenerationTimestamp: "true"
packageName: rust-axum-header-uui
enablePostProcessFile: true