summaryrefslogtreecommitdiffstats
path: root/generator/src/structs.rs
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-02-10 04:43:33 +0100
committerCyborus <cyborus@cyborus.xyz>2024-02-10 04:43:33 +0100
commite53fa0b631c5bad85d960abe89671cc04d8e066b (patch)
tree3ec0b35f6996990f0e10c50fcc6ff5da73a90147 /generator/src/structs.rs
parenteven more strongly typed returns (diff)
downloadforgejo-api-e53fa0b631c5bad85d960abe89671cc04d8e066b.tar.xz
forgejo-api-e53fa0b631c5bad85d960abe89671cc04d8e066b.zip
format
Diffstat (limited to '')
-rw-r--r--generator/src/structs.rs12
1 files changed, 10 insertions, 2 deletions
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)?;