Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions tests/cases/simple/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,34 @@
}
}
}
},
"/echo": {
"post": {
"operationId": "echo",
"summary": "Echo a shared type",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SharedType"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SharedType"
}
}
}
}
}
}
}
},
"components": {
Expand Down Expand Up @@ -479,6 +507,14 @@
},
"RefChainB": {
"$ref": "#/components/schemas/SubType"
},
"SharedType": {
"type": "object",
"properties": {
"value": {
"type": "string"
}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/simple/output/add-operation.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- add-operation.json
+++ patched
@@
"summary": "Get arrays"
"summary": "Echo a shared type"
}
},
+ "/foo": {
Expand Down
64 changes: 64 additions & 0 deletions tests/cases/simple/output/input-output-schema-change.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
--- input-output-schema-change.json
+++ patched
@@
"SharedType": {
"properties": {
"value": {
- "type": "string"
+ "type": "integer"
}
},
"type": "object"


Result for patch:
[
Change {
paths: [
ChangePath {
old: [
"#/components/schemas/SharedType/properties/value",
"#/paths/~1echo/post/request_body/content/application~1json/schema/$ref",
],
new: [
"#/components/schemas/SharedType/properties/value",
"#/paths/~1echo/post/request_body/content/application~1json/schema/$ref",
],
comparison: Input,
},
],
changes: [
ChangeInfo {
old_subpath: "",
new_subpath: "",
message: "schema types changed",
class: Incompatible,
details: UnknownDifference,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised that this is unknown? or is this expected.

},
],
},
Change {
paths: [
ChangePath {
old: [
"#/components/schemas/SharedType/properties/value",
"#/paths/~1echo/post/responses/200/content/application~1json/schema/$ref",
],
new: [
"#/components/schemas/SharedType/properties/value",
"#/paths/~1echo/post/responses/200/content/application~1json/schema/$ref",
],
comparison: Output,
},
],
changes: [
ChangeInfo {
old_subpath: "",
new_subpath: "",
message: "schema types changed",
class: Incompatible,
details: UnknownDifference,
},
],
},
]
2 changes: 1 addition & 1 deletion tests/cases/simple/output/ref-chain-change.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- "$ref": "#/components/schemas/SubType"
+ "$ref": "#/components/schemas/ErrorResponse"
},
"SubType": {
"SharedType": {
"properties": {


Expand Down
81 changes: 81 additions & 0 deletions tests/cases/simple/output/ref-vs-inline-type-change.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
--- ref-vs-inline-type-change.json
+++ patched
@@
]
},
"via_ref": {
- "$ref": "#/components/schemas/SubType"
+ "properties": {
+ "value": {
+ "type": "integer"
+ }
+ },
+ "type": "object"
}
},
"required": [
@@
"SubType": {
"properties": {
"value": {
- "type": "string"
+ "type": "integer"
}
},
"type": "object"


Result for patch:
[
Change {
paths: [
ChangePath {
old: [
"#/components/schemas/SubType/properties/value",
"#/components/schemas/GreetingResponse/properties/via_allof/0/$ref",
"#/paths/~1hello~1{name}/get/responses/200/content/application~1json/schema/$ref",
],
new: [
"#/components/schemas/SubType/properties/value",
"#/components/schemas/GreetingResponse/properties/via_allof/0/$ref",
"#/paths/~1hello~1{name}/get/responses/200/content/application~1json/schema/$ref",
],
comparison: Output,
},
],
changes: [
ChangeInfo {
old_subpath: "",
new_subpath: "",
message: "schema types changed",
class: Incompatible,
details: UnknownDifference,
},
],
},
Change {
paths: [
ChangePath {
old: [
"#/components/schemas/SubType/properties/value",
"#/components/schemas/GreetingResponse/properties/via_ref/$ref",
"#/paths/~1hello~1{name}/get/responses/200/content/application~1json/schema/$ref",
],
new: [
"#/components/schemas/GreetingResponse/properties/via_ref/properties/value",
"#/paths/~1hello~1{name}/get/responses/200/content/application~1json/schema/$ref",
],
comparison: Output,
},
],
changes: [
ChangeInfo {
old_subpath: "",
new_subpath: "",
message: "schema types changed",
class: Incompatible,
details: UnknownDifference,
},
],
},
]
2 changes: 1 addition & 1 deletion tests/cases/simple/output/schema-kind-type-to-oneof.out
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--- schema-kind-type-to-oneof.json
+++ patched
@@
"$ref": "#/components/schemas/SubType"
"type": "object"
},
"SubType": {
- "properties": {
Expand Down
7 changes: 7 additions & 0 deletions tests/cases/simple/patch/input-output-schema-change.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"op": "replace",
"path": "/components/schemas/SharedType/properties/value/type",
"value": "integer"
}
]
19 changes: 19 additions & 0 deletions tests/cases/simple/patch/ref-vs-inline-type-change.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"op": "replace",
"path": "/components/schemas/SubType/properties/value/type",
"value": "integer"
},
{
"op": "replace",
"path": "/components/schemas/GreetingResponse/properties/via_ref",
"value": {
"type": "object",
"properties": {
"value": {
"type": "integer"
}
}
}
}
]
You are viewing a condensed version of this merge commit. You can view the full changes here.