-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utopia-gen/tests/schema_generics: Use
insta
for snapshot testing
`insta` produces diffs like the following, which makes it much easier to see at first glance what changed. The `cargo-insta` extension also makes it very fast to update snapshots in case of any desired changes. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot file: utoipa-gen/tests/snapshots/schema_generics__generic_schema_full_api.snap Snapshot: generic_schema_full_api Source: utoipa-gen/tests/schema_generics.rs:221 ──────────────────────────────────────────────────────────────────────────────── Expression: doc ──────────────────────────────────────────────────────────────────────────────── -old snapshot +new results ────────────┬─────────────────────────────────────────────────────────────────── 64 64 │ "items" 65 65 │ ], 66 66 │ "properties": { 67 67 │ "items": { 68 │- "type": "object", 68 │+ "type": "array", 69 69 │ "items": { 70 70 │ "type": "object", 71 71 │ "required": [ 72 72 │ "id", ────────────┴─────────────────────────────────────────────────────────────────── To update snapshots run `cargo insta review`
- Loading branch information
Showing
11 changed files
with
118 additions
and
483 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...schema_generic_collect_non_inlined_schema → ...collect_recursive_schema_not_inlined.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...ma_generic_enum_variant_with_generic_type → ..._derive_generic_schema_enum_variants.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
utoipa-gen/tests/snapshots/schema_generics__generic_request_body_schema.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
source: utoipa-gen/tests/schema_generics.rs | ||
expression: doc | ||
snapshot_kind: text | ||
--- | ||
{ | ||
"openapi": "3.1.0", | ||
"info": { | ||
"title": "title", | ||
"version": "version" | ||
}, | ||
"paths": { | ||
"/handler": { | ||
"get": { | ||
"tags": [], | ||
"operationId": "handler", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"field", | ||
"t" | ||
], | ||
"properties": { | ||
"field": { | ||
"type": "string" | ||
}, | ||
"t": { | ||
"type": "object", | ||
"required": [ | ||
"t" | ||
], | ||
"properties": { | ||
"t": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": {} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"Person_String_path.MyType_i32": { | ||
"type": "object", | ||
"required": [ | ||
"field", | ||
"t" | ||
], | ||
"properties": { | ||
"field": { | ||
"type": "string" | ||
}, | ||
"t": { | ||
"type": "object", | ||
"required": [ | ||
"t" | ||
], | ||
"properties": { | ||
"t": { | ||
"type": "integer", | ||
"format": "int32" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...en/tests/testdata/schema_generics_openapi → ...ma_generics__generic_schema_full_api.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...en/tests/testdata/schema_high_order_types → ...ts/schema_generics__high_order_types.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...chema_non_generic_root_generic_references → ...nerics__schema_with_non_generic_root.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.