@@ -45,7 +45,9 @@ func (d DebugSpec) String() string {
45
45
}
46
46
func TestFilterSpecs (t * testing.T ) {
47
47
var spec1 , spec1_filtered * spec.Swagger
48
- yaml .Unmarshal ([]byte (`
48
+ ast := assert .New (t )
49
+
50
+ err := yaml .Unmarshal ([]byte (`
49
51
swagger: "2.0"
50
52
paths:
51
53
/test:
@@ -65,6 +67,11 @@ paths:
65
67
405:
66
68
description: "Invalid input"
67
69
$ref: "#/definitions/InvalidInput"
70
+ delete:
71
+ summary: "Test API Delete"
72
+ operationId: "deleteTest"
73
+ parameters:
74
+ - $ref: "#/parameters/body-deleteoptions"
68
75
/othertest:
69
76
post:
70
77
tags:
@@ -82,6 +89,12 @@ paths:
82
89
required: true
83
90
schema:
84
91
$ref: "#/definitions/Test2"
92
+ delete:
93
+ summary: "Test2 API Delete"
94
+ operationId: "deleteTest2"
95
+ parameters:
96
+ - schema:
97
+ $ref: "#/definitions/DeleteOptions"
85
98
definitions:
86
99
Test:
87
100
type: "object"
@@ -102,9 +115,24 @@ definitions:
102
115
$ref: "#/definitions/Other"
103
116
Other:
104
117
type: "string"
118
+ DeleteOptions:
119
+ type: "object"
120
+ properties:
121
+ preconditions:
122
+ $ref: "#/definitions/Preconditions"
123
+ Preconditions:
124
+ type: "string"
125
+ parameters:
126
+ body-deleteoptions:
127
+ name: body
128
+ in: body
129
+ schema:
130
+ $ref: "#/definitions/DeleteOptions"
105
131
` ), & spec1 )
106
132
107
- yaml .Unmarshal ([]byte (`
133
+ ast .NoError (err )
134
+
135
+ err = yaml .Unmarshal ([]byte (`
108
136
swagger: "2.0"
109
137
paths:
110
138
/test:
@@ -124,6 +152,11 @@ paths:
124
152
405:
125
153
description: "Invalid input"
126
154
$ref: "#/definitions/InvalidInput"
155
+ delete:
156
+ summary: "Test API Delete"
157
+ operationId: "deleteTest"
158
+ parameters:
159
+ - $ref: "#/parameters/body-deleteoptions"
127
160
definitions:
128
161
Test:
129
162
type: "object"
@@ -137,9 +170,22 @@ definitions:
137
170
InvalidInput:
138
171
type: "string"
139
172
format: "string"
173
+ DeleteOptions:
174
+ type: "object"
175
+ properties:
176
+ preconditions:
177
+ $ref: "#/definitions/Preconditions"
178
+ Preconditions:
179
+ type: "string"
180
+ parameters:
181
+ body-deleteoptions:
182
+ name: body
183
+ in: body
184
+ schema:
185
+ $ref: "#/definitions/DeleteOptions"
140
186
` ), & spec1_filtered )
187
+ ast .NoError (err )
141
188
142
- ast := assert .New (t )
143
189
orig_spec1 , _ := cloneSpec (spec1 )
144
190
new_spec1 := FilterSpecByPathsWithoutSideEffects (spec1 , []string {"/test" })
145
191
ast .Equal (DebugSpec {spec1_filtered }, DebugSpec {new_spec1 })
0 commit comments