Skip to content

Commit

Permalink
Add a trailing newline to OpenAPI spec output (#988)
Browse files Browse the repository at this point in the history
Co-authored-by: Rain <rain@oxide.computer>
  • Loading branch information
jgallagher and sunshowers committed May 15, 2024
1 parent cc3ccfc commit 0f70a10
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dropshot/src/api_description.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::CONTENT_TYPE_URL_ENCODED;

use http::Method;
use http::StatusCode;
use serde::de::Error;
use serde::Deserialize;
use serde::Serialize;
use std::collections::BTreeMap;
Expand Down Expand Up @@ -1058,9 +1059,11 @@ impl<'a, Context: ServerContext> OpenApiDefinition<'a, Context> {
out: &mut dyn std::io::Write,
) -> serde_json::Result<()> {
serde_json::to_writer_pretty(
out,
&mut *out,
&self.api.gen_openapi(self.info.clone()),
)
)?;
writeln!(out).map_err(serde_json::Error::custom)?;
Ok(())
}
}

Expand Down
2 changes: 1 addition & 1 deletion dropshot/tests/test_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1064,4 +1064,4 @@
"name": "woman"
}
]
}
}
2 changes: 1 addition & 1 deletion dropshot/tests/test_openapi_fuller.json
Original file line number Diff line number Diff line change
Expand Up @@ -1073,4 +1073,4 @@
"name": "woman"
}
]
}
}
2 changes: 1 addition & 1 deletion dropshot/tests/test_pagination_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@
}
}
}
}
}

0 comments on commit 0f70a10

Please sign in to comment.