Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Rust raw identifiers #206

Merged
merged 1 commit into from
Jul 3, 2022
Merged

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Jul 3, 2022

Add support for Rust raw identifiers to the Component and IntoParams fields.

Previously Rust code with raw identifiers as keys for component fields
and parameter names caused the name contain the raw identifer prefix
which is not wanted behaviour.

struct Bar {
    r#in: String
}

This commit will fix this behaviour to the utoipa-gen crate stripping
out the raw identifer prefix from field name so in above case the output
name will be in and not r#in.

Re implements #167 to utoipa-gen leaving the utoipa crate containing the OpenAPI types untouched.

Add support for Rust [raw identifiers](https://doc.rust-lang.org/rust-by-example/compatibility/raw_identifiers.html)
to the `Component` and `IntoParams` fields.

Previously Rust code with raw identifiers as keys for component fields
and parameter names caused the name contain the raw identifer prefix
which is not wanted behaviour.
```rust
struct Bar {
    r#in: String
}
```

This commit will fix this behaviour to the utoipa-gen crate stripping
out the raw identifer prefix from field name so in above case the output
name will be `in` and not `r#in`.
@juhaku juhaku merged commit a600b9b into master Jul 3, 2022
@juhaku juhaku deleted the feature-raw-identifiers branch July 3, 2022 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

1 participant