rustfmt
This commit is contained in:
parent
5e8b9d0e8c
commit
179dee4aaf
26
src/main.rs
26
src/main.rs
|
@ -620,7 +620,8 @@ impl TypeSpace {
|
||||||
"&str"
|
"&str"
|
||||||
} else {
|
} else {
|
||||||
n
|
n
|
||||||
}.to_string())
|
}
|
||||||
|
.to_string())
|
||||||
} else {
|
} else {
|
||||||
bail!("basic type {:?} does not have a name?", tid);
|
bail!("basic type {:?} does not have a name?", tid);
|
||||||
}
|
}
|
||||||
|
@ -989,10 +990,8 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result<String> {
|
||||||
* Omit missing optionals from the document entirely; do
|
* Omit missing optionals from the document entirely; do
|
||||||
* not inject a "null" value.
|
* not inject a "null" value.
|
||||||
*/
|
*/
|
||||||
a(
|
a(" #[serde(skip_serializing_if = \
|
||||||
" #[serde(skip_serializing_if = \
|
\"Option::is_none\")]");
|
||||||
\"Option::is_none\")]"
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
a(&format!(
|
a(&format!(
|
||||||
" pub {}: {},",
|
" pub {}: {},",
|
||||||
|
@ -1078,8 +1077,10 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result<String> {
|
||||||
a(" Client::new_with_client(baseurl, client)");
|
a(" Client::new_with_client(baseurl, client)");
|
||||||
a(" }");
|
a(" }");
|
||||||
a("");
|
a("");
|
||||||
a(" pub fn new_with_client(baseurl: &str, client: reqwest::Client) \
|
a(
|
||||||
-> Client {");
|
" pub fn new_with_client(baseurl: &str, client: reqwest::Client) \
|
||||||
|
-> Client {",
|
||||||
|
);
|
||||||
a(" Client {");
|
a(" Client {");
|
||||||
a(" baseurl: baseurl.to_string(),");
|
a(" baseurl: baseurl.to_string(),");
|
||||||
a(" client,");
|
a(" client,");
|
||||||
|
@ -1131,7 +1132,10 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result<String> {
|
||||||
if let Some(s) = &mt.schema {
|
if let Some(s) = &mt.schema {
|
||||||
let tid = ts.select(None, s)?;
|
let tid = ts.select(None, s)?;
|
||||||
(
|
(
|
||||||
Some(format!("&{}", ts.render_type(&tid, UseContext::Return)?)),
|
Some(format!(
|
||||||
|
"&{}",
|
||||||
|
ts.render_type(&tid, UseContext::Return)?
|
||||||
|
)),
|
||||||
Some("json".to_string()),
|
Some("json".to_string()),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -1162,7 +1166,8 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result<String> {
|
||||||
|
|
||||||
let nam = ¶meter_data.name;
|
let nam = ¶meter_data.name;
|
||||||
let tid = ts.select(None, parameter_data.schema()?)?;
|
let tid = ts.select(None, parameter_data.schema()?)?;
|
||||||
let typ = ts.render_type(&tid, UseContext::Parameter)?;
|
let typ =
|
||||||
|
ts.render_type(&tid, UseContext::Parameter)?;
|
||||||
a(&format!(" {}: {},", nam, typ));
|
a(&format!(" {}: {},", nam, typ));
|
||||||
}
|
}
|
||||||
openapiv3::Parameter::Query {
|
openapiv3::Parameter::Query {
|
||||||
|
@ -1188,7 +1193,8 @@ fn gen(api: &OpenAPI, ts: &mut TypeSpace) -> Result<String> {
|
||||||
*/
|
*/
|
||||||
ts.id_for_optional(&tid)
|
ts.id_for_optional(&tid)
|
||||||
};
|
};
|
||||||
let typ = ts.render_type(&tid, UseContext::Parameter)?;
|
let typ =
|
||||||
|
ts.render_type(&tid, UseContext::Parameter)?;
|
||||||
a(&format!(" {}: {},", nam, typ));
|
a(&format!(" {}: {},", nam, typ));
|
||||||
|
|
||||||
query.push((nam.to_string(), !parameter_data.required));
|
query.push((nam.to_string(), !parameter_data.required));
|
||||||
|
|
Loading…
Reference in New Issue