Skip to content

Commit

Permalink
Fix broken tests
Browse files Browse the repository at this point in the history
Fix broken tests in `utiopa-gen` since version bump.
  • Loading branch information
juhaku committed Oct 3, 2024
1 parent 820d05e commit b31d078
Show file tree
Hide file tree
Showing 5 changed files with 223 additions and 246 deletions.
1 change: 1 addition & 0 deletions utoipa-gen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

### Changed

* Fix broken tests
* Fix typos
* Update `utoipa-config` version
* Remove commit commit id from changelogs (https://github.com/juhaku/utoipa/pull/1077)
Expand Down
4 changes: 3 additions & 1 deletion utoipa-gen/tests/openapi_derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,9 @@ fn openapi_schemas_resolve_schema_references() {

let doc = ApiDoc::openapi();

let json = serde_json::to_string_pretty(&doc).expect("OpenAPI is json serializable");
let value = serde_json::to_value(&doc).expect("OpenAPI is JSON serializable");
let schemas = value.pointer("/components").unwrap();
let json = serde_json::to_string_pretty(&schemas).expect("OpenAPI is json serializable");
println!("{json}");

let expected =
Expand Down
10 changes: 5 additions & 5 deletions utoipa-gen/tests/schema_generics.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;

use utoipa::openapi::{RefOr, Schema};
use utoipa::openapi::{Info, RefOr, Schema};
use utoipa::{schema, OpenApi, ToSchema};

#[test]
Expand Down Expand Up @@ -63,11 +63,11 @@ fn generic_schema_full_api() {
)]
struct ApiDoc;

let actual = ApiDoc::openapi()
.to_pretty_json()
.expect("ApiDoc is JSON serializable");
println!("{actual}");
let mut doc = ApiDoc::openapi();
doc.info = Info::new("title", "version");

let actual = doc.to_pretty_json().expect("OpenApi is JSON serializable");
println!("{actual}");
let expected = include_str!("./testdata/schema_generics_openapi");

assert_eq!(expected.trim(), actual.trim());
Expand Down
Loading

0 comments on commit b31d078

Please sign in to comment.