summaryrefslogtreecommitdiffstats
path: root/generator/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--generator/src/main.rs2
-rw-r--r--generator/src/structs.rs12
2 files changed, 11 insertions, 3 deletions
diff --git a/generator/src/main.rs b/generator/src/main.rs
index 3aece4f..6ca4b45 100644
--- a/generator/src/main.rs
+++ b/generator/src/main.rs
@@ -4,7 +4,7 @@ mod methods;
mod openapi;
mod structs;
-use heck::{ToSnakeCase, ToPascalCase};
+use heck::{ToPascalCase, ToSnakeCase};
use openapi::*;
fn main() -> eyre::Result<()> {
diff --git a/generator/src/structs.rs b/generator/src/structs.rs
index 7b7672a..842e557 100644
--- a/generator/src/structs.rs
+++ b/generator/src/structs.rs
@@ -607,7 +607,11 @@ pub fn create_response_structs(spec: &OpenApiV2, item: &PathItem) -> eyre::Resul
pub fn create_response_structs_for_op(spec: &OpenApiV2, op: &Operation) -> eyre::Result<String> {
let mut out = String::new();
- let op_name = op.operation_id.as_deref().ok_or_else(|| eyre::eyre!("no operation id"))?.to_pascal_case();
+ let op_name = op
+ .operation_id
+ .as_deref()
+ .ok_or_else(|| eyre::eyre!("no operation id"))?
+ .to_pascal_case();
for (_, response) in &op.responses.http_codes {
let response = response.deref(spec)?;
let tys = create_response_struct(spec, &op_name, response)?;
@@ -616,7 +620,11 @@ pub fn create_response_structs_for_op(spec: &OpenApiV2, op: &Operation) -> eyre:
Ok(out)
}
-pub fn create_response_struct(spec: &OpenApiV2, name: &str, res: &Response) -> eyre::Result<String> {
+pub fn create_response_struct(
+ spec: &OpenApiV2,
+ name: &str,
+ res: &Response,
+) -> eyre::Result<String> {
let mut types = Vec::new();
if let Some(MaybeRef::Value { value }) = &res.schema {
crate::schema_subtypes(spec, name, "Response", value, &mut types)?;