Skip to content

Commit

Permalink
url encoding for path parameters (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
kilork authored Oct 7, 2024
1 parent bec3a02 commit 7a72f05
Show file tree
Hide file tree
Showing 5 changed files with 691 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ async-trait = "0.1"
schemars = { version = "0.8.11", default-features = false, features = [
"derive",
], optional = true }
percent-encoding = "2.3.1"

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
Expand Down
8 changes: 7 additions & 1 deletion examples/openapi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,12 @@ mod openapi {
.collect::<Vec<_>>();
let has_query_parameters = !query_parameters.is_empty();

for (parameter, parameter_name) in &parameters {
if parameter.position == ParameterPosition::Path {
output.push(format!(" let {parameter_name} = p({parameter_name});"));
}
}

output.push(
if has_query_parameters {
" let mut builder = self"
Expand Down Expand Up @@ -1100,7 +1106,7 @@ fn generate_rest(spec: &openapi::Spec) {
r###"use reqwest::header::CONTENT_LENGTH;
use serde_json::Value;
use super::*;
use super::{{*, url_enc::encode_url_param as p}};
impl<TS: KeycloakTokenSupplier> KeycloakAdmin<TS> {{
"###
Expand Down
Loading

0 comments on commit 7a72f05

Please sign in to comment.