Skip to content

Commit 1067c32

Browse files
jianyexijianye ximikekistler
authored
bugfixes (#250)
* bugfix for AddedPropertyInResponse * fix reference redirection * property required status change is breaking change * fix test * Update openapi-diff/src/modeler/AutoRest.Swagger.Tests/SwaggerModelerCompareTests.cs Co-authored-by: Mike Kistler <[email protected]> * fix comments * update test Co-authored-by: jianye xi <[email protected]> Co-authored-by: Mike Kistler <[email protected]>
1 parent 2ab6456 commit 1067c32

12 files changed

+811
-16
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Changelog
2+
3+
## 0.10.1 Released on 2022-10-15
4+
5+
- Bugfixes for ReferenceRedirection,AddedPropertyInResponse,DefaultValueChanged.
6+
27
## 0.10.0 Released on 2022-09-15
38

49
- Added rules: AddedXmsEnum,RemovedXmsEnum,XmsEnumChanged.

docs/rules/1017.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### 1017 - ReferenceRedirection
22

33
**Description**: Checks whether any '$ref' property points to different models from the previous specification.
4+
note: if the model is flagged with 'x-ms-client-name', the 'x-ms-client-name' will override the reference name.
45

56
**Cause**: This is considered a breaking change.
67

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "operation_check_01",
5+
"version": "1.0"
6+
},
7+
"host": "localhost:8000",
8+
"schemes": [ "http", "https" ],
9+
"paths": {
10+
"/api/Parameters": {
11+
"put": {
12+
"tags": [ "Parameters" ],
13+
"operationId": "Parameters_Put",
14+
"produces": [
15+
"text/plain"
16+
],
17+
"parameters": [
18+
{
19+
"name": "database",
20+
"in": "body",
21+
"required": true,
22+
"schema": { "$ref": "#/definitions/DatabaseRenamed" }
23+
}
24+
],
25+
"responses": {
26+
"200": {
27+
"schema":{
28+
"$ref": "#/definitions/DatabaseRenamed"
29+
}
30+
}
31+
}
32+
}
33+
}
34+
},
35+
"definitions": {
36+
"Error": {
37+
"required": [ "message", "id" ],
38+
"properties": {
39+
"message": { "type": "string" },
40+
"id": { "type": "integer" }
41+
}
42+
},
43+
"Register": {
44+
"required": [ "b" ],
45+
"properties": {
46+
"a": {
47+
"type": "string",
48+
"description": "The user generated unique name for the database, a string that\n must not be more than 255 characters."
49+
},
50+
"b": {
51+
"type": "integer",
52+
"readOnly": true,
53+
"description": "This is a system generated property.\nThe resource id (_rid) is a unique identifier that is also hierarchical per the resource stack on the resource model. It is used internally for placement of and navigation to the database resource.",
54+
"default": 11
55+
},
56+
"c": {
57+
"type": "integer",
58+
"format": "int32",
59+
"readOnly": true,
60+
"description": "This is a system generated property.\nIt specifies the last updated timestamp of the resource. The value is a timestamp."
61+
},
62+
"d": {
63+
"type": "string",
64+
"readOnly": true,
65+
"description": "This is a system generated property.\nIt represents the resource etag required for optimistic concurrency control."
66+
},
67+
"e": {
68+
"type": "string",
69+
"readOnly": true,
70+
"description": "This is a system generated property.\nIt specifies the addressable path of the collections resource."
71+
},
72+
"f": {
73+
"type": "string",
74+
"readOnly": true,
75+
"description": "This is a system generated property.\nIt specifies the addressable path of the users resource."
76+
}
77+
}
78+
},
79+
"DatabaseRenamed": {
80+
"description": "IP firewall rule",
81+
"type": "object",
82+
"allOf": [
83+
{
84+
"$ref": "#/definitions/Resource"
85+
}
86+
],
87+
"properties": {
88+
"properties": {
89+
"$ref": "#/definitions/IpFirewallRuleProperties",
90+
"description": "IP firewall rule properties",
91+
"x-ms-client-flatten": true
92+
}
93+
}
94+
},
95+
"IpFirewallRuleProperties": {
96+
"description": "IP firewall rule properties",
97+
"type": "object",
98+
"properties": {
99+
"endIpAddress": {
100+
"description": "The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress",
101+
"type": "string",
102+
"x-ms-mutability": [
103+
"create",
104+
"read",
105+
"update"
106+
]
107+
},
108+
"provisioningState": {
109+
"description": "Resource provisioning state",
110+
"enum": [
111+
"Provisioning",
112+
"Succeeded",
113+
"Deleting",
114+
"Failed",
115+
"DeleteError"
116+
],
117+
"type": "string",
118+
"readOnly": true,
119+
"x-ms-enum": {
120+
"name": "ProvisioningState",
121+
"modelAsString": true
122+
}
123+
},
124+
"startIpAddress": {
125+
"description": "The start IP address of the firewall rule. Must be IPv4 format",
126+
"type": "string",
127+
"x-ms-mutability": [
128+
"create",
129+
"read",
130+
"update"
131+
]
132+
}
133+
}
134+
},
135+
"Resource": {
136+
"title": "Resource",
137+
"description": "Common fields that are returned in the response for all Azure Resource Manager resources",
138+
"type": "object",
139+
"properties": {
140+
"id": {
141+
"readOnly": true,
142+
"type": "string",
143+
"description": "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
144+
},
145+
"name": {
146+
"readOnly": true,
147+
"type": "string",
148+
"description": "The name of the resource"
149+
},
150+
"type": {
151+
"readOnly": true,
152+
"type": "string",
153+
"description": "The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or \"Microsoft.Storage/storageAccounts\""
154+
}
155+
},
156+
"x-ms-azure-resource": true
157+
}
158+
}
159+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "operation_check_01",
5+
"version": "1.0"
6+
},
7+
"host": "localhost:8000",
8+
"schemes": [ "http", "https" ],
9+
"paths": {
10+
},
11+
"definitions": {
12+
"Register": {
13+
"required": [ "b"],
14+
"properties": {
15+
"a": {
16+
"type": "string",
17+
"description": "The user generated unique name for the database, a string that\n must not be more than 255 characters."
18+
},
19+
"b": {
20+
"type": "integer",
21+
"readOnly": true,
22+
"description": "This is a system generated property.\nThe resource id (_rid) is a unique identifier that is also hierarchical per the resource stack on the resource model. It is used internally for placement of and navigation to the database resource.",
23+
"default": 11
24+
},
25+
"c": {
26+
"type": "integer",
27+
"format": "int32",
28+
"readOnly": true,
29+
"description": "This is a system generated property.\nIt specifies the last updated timestamp of the resource. The value is a timestamp."
30+
},
31+
"d": {
32+
"type": "string",
33+
"readOnly": true,
34+
"description": "This is a system generated property.\nIt represents the resource etag required for optimistic concurrency control."
35+
},
36+
"e": {
37+
"type": "string",
38+
"readOnly": true,
39+
"description": "This is a system generated property.\nIt specifies the addressable path of the collections resource."
40+
},
41+
"f": {
42+
"type": "string",
43+
"readOnly": true,
44+
"description": "This is a system generated property.\nIt specifies the addressable path of the users resource."
45+
}
46+
}
47+
}
48+
}
49+
}
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"swagger": "2.0",
3+
"info": {
4+
"title": "operation_check_01",
5+
"version": "1.0"
6+
},
7+
"host": "localhost:8000",
8+
"schemes": [ "http", "https" ],
9+
"paths": {
10+
"/api/Parameters": {
11+
"put": {
12+
"tags": [ "Parameters" ],
13+
"operationId": "Parameters_Put",
14+
"produces": [
15+
"text/plain"
16+
],
17+
"parameters": [
18+
{
19+
"name": "database",
20+
"in": "body",
21+
"required": true,
22+
"schema": { "$ref": "#/definitions/DatabaseRenamed" }
23+
}
24+
],
25+
"responses": {}
26+
},
27+
"post": {
28+
"tags": [ "Parameters" ],
29+
"operationId": "Parameters_Post",
30+
"produces": [
31+
"text/plain"
32+
],
33+
"parameters": [
34+
{
35+
"name": "registry",
36+
"in": "body",
37+
"required": true,
38+
"schema": { "$ref": "#/definitions/Register" }
39+
}
40+
],
41+
"responses": {}
42+
}
43+
},
44+
"/api/Responses": {
45+
"get": {
46+
"tags": [ "Responses" ],
47+
"operationId": "Responses_Get",
48+
"produces": [
49+
"text/plain"
50+
],
51+
"parameters": [],
52+
"responses": {
53+
"200": {
54+
"schema": {
55+
"type": "integer"
56+
}
57+
},
58+
"201": {
59+
"schema": {
60+
"type": "integer"
61+
}
62+
},
63+
"400": {
64+
"schema": { "$ref": "#/definitions/Error" }
65+
}
66+
}
67+
}
68+
}
69+
},
70+
"definitions": {
71+
"Error": {
72+
"required": [ "message", "id" ],
73+
"properties": {
74+
"message": { "type": "string" },
75+
"id": { "type": "integer" }
76+
}
77+
},
78+
"DatabaseRenamed": {
79+
"x-ms-client-name":"database",
80+
"required": [ "id" ],
81+
"properties": {
82+
"a": {
83+
"type": "string",
84+
"description": "The user generated unique name for the database, a string that\n must not be more than 255 characters."
85+
},
86+
"b": {
87+
"type": "string",
88+
"readOnly": true,
89+
"description": "This is a system generated property.\nThe resource id (_rid) is a unique identifier that is also hierarchical per the resource stack on the resource model. It is used internally for placement of and navigation to the database resource."
90+
},
91+
"c": {
92+
"type": "integer",
93+
"format": "int32",
94+
"readOnly": true,
95+
"description": "This is a system generated property.\nIt specifies the last updated timestamp of the resource. The value is a timestamp."
96+
},
97+
"d": {
98+
"type": "string",
99+
"readOnly": true,
100+
"description": "This is a system generated property.\nIt represents the resource etag required for optimistic concurrency control."
101+
},
102+
"e": {
103+
"type": "string",
104+
"readOnly": true,
105+
"description": "This is a system generated property.\nIt specifies the addressable path of the collections resource."
106+
},
107+
"f": {
108+
"type": "string",
109+
"readOnly": true,
110+
"description": "This is a system generated property.\nIt specifies the addressable path of the users resource."
111+
}
112+
}
113+
},
114+
"Register": {
115+
"required": [ "id" ],
116+
"properties": {
117+
"a": {
118+
"type": "string",
119+
"description": "The user generated unique name for the database, a string that\n must not be more than 255 characters."
120+
},
121+
"b": {
122+
"type": "integer",
123+
"readOnly": true,
124+
"description": "This is a system generated property.\nThe resource id (_rid) is a unique identifier that is also hierarchical per the resource stack on the resource model. It is used internally for placement of and navigation to the database resource.",
125+
"default": 11
126+
},
127+
"c": {
128+
"type": "integer",
129+
"format": "int32",
130+
"readOnly": true,
131+
"description": "This is a system generated property.\nIt specifies the last updated timestamp of the resource. The value is a timestamp."
132+
},
133+
"d": {
134+
"type": "string",
135+
"readOnly": true,
136+
"description": "This is a system generated property.\nIt represents the resource etag required for optimistic concurrency control."
137+
},
138+
"e": {
139+
"type": "string",
140+
"readOnly": true,
141+
"description": "This is a system generated property.\nIt specifies the addressable path of the collections resource."
142+
},
143+
"f": {
144+
"type": "string",
145+
"readOnly": true,
146+
"description": "This is a system generated property.\nIt specifies the addressable path of the users resource."
147+
}
148+
}
149+
,
150+
"default": {
151+
"id": "test"
152+
}
153+
}
154+
}
155+
}

0 commit comments

Comments
 (0)