|
18 | 18 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
19 | 19 | import com.fasterxml.jackson.annotation.JsonProperty; |
20 | 20 | import com.fasterxml.jackson.databind.JsonNode; |
21 | | - |
22 | 21 | import java.util.List; |
23 | 22 | import java.util.Locale; |
24 | 23 | import java.util.Map; |
|
27 | 26 | import java.util.Set; |
28 | 27 |
|
29 | 28 | @JsonIgnoreProperties(ignoreUnknown = true) |
30 | | -public record MinimalOpenAPI( |
| 29 | +public record UnifiedOpenAPI( |
31 | 30 | String swagger, |
32 | 31 | List<Server> servers, |
33 | 32 | String host, |
@@ -138,97 +137,97 @@ private Schema resolveRefSwaggerV2(String ref) { |
138 | 137 | @JsonIgnoreProperties(ignoreUnknown = true) |
139 | 138 | public record Server(String url) {} |
140 | 139 |
|
141 | | - @JsonIgnoreProperties(ignoreUnknown = true) |
142 | | - public static final class PathItem { |
143 | | - private final Operation get; |
144 | | - private final Operation post; |
145 | | - private final Operation put; |
146 | | - private final Operation delete; |
147 | | - private final Operation patch; |
148 | | - private final Operation head; |
149 | | - private final Operation options; |
150 | | - private final Set<HttpOperation> methods; |
151 | | - |
152 | | - public PathItem( |
153 | | - Operation get, |
154 | | - Operation post, |
155 | | - Operation put, |
156 | | - Operation delete, |
157 | | - Operation patch, |
158 | | - Operation head, |
159 | | - Operation options) { |
160 | | - this.get = get; |
161 | | - this.post = post; |
162 | | - this.put = put; |
163 | | - this.delete = delete; |
164 | | - this.patch = patch; |
165 | | - this.head = head; |
166 | | - this.options = options; |
167 | | - this.methods = buildMethods(); |
168 | | - } |
| 140 | + @JsonIgnoreProperties(ignoreUnknown = true) |
| 141 | + public static final class PathItem { |
| 142 | + private final Operation get; |
| 143 | + private final Operation post; |
| 144 | + private final Operation put; |
| 145 | + private final Operation delete; |
| 146 | + private final Operation patch; |
| 147 | + private final Operation head; |
| 148 | + private final Operation options; |
| 149 | + private final Set<HttpOperation> methods; |
| 150 | + |
| 151 | + public PathItem( |
| 152 | + Operation get, |
| 153 | + Operation post, |
| 154 | + Operation put, |
| 155 | + Operation delete, |
| 156 | + Operation patch, |
| 157 | + Operation head, |
| 158 | + Operation options) { |
| 159 | + this.get = get; |
| 160 | + this.post = post; |
| 161 | + this.put = put; |
| 162 | + this.delete = delete; |
| 163 | + this.patch = patch; |
| 164 | + this.head = head; |
| 165 | + this.options = options; |
| 166 | + this.methods = buildMethods(); |
| 167 | + } |
169 | 168 |
|
170 | | - private Set<HttpOperation> buildMethods() { |
171 | | - return Set.of( |
172 | | - new HttpOperation("get", get), |
173 | | - new HttpOperation("post", post), |
174 | | - new HttpOperation("put", put), |
175 | | - new HttpOperation("delete", delete), |
176 | | - new HttpOperation("patch", patch), |
177 | | - new HttpOperation("head", head), |
178 | | - new HttpOperation("options", options)); |
179 | | - } |
| 169 | + private Set<HttpOperation> buildMethods() { |
| 170 | + return Set.of( |
| 171 | + new HttpOperation("get", get), |
| 172 | + new HttpOperation("post", post), |
| 173 | + new HttpOperation("put", put), |
| 174 | + new HttpOperation("delete", delete), |
| 175 | + new HttpOperation("patch", patch), |
| 176 | + new HttpOperation("head", head), |
| 177 | + new HttpOperation("options", options)); |
| 178 | + } |
180 | 179 |
|
181 | | - Set<HttpOperation> methods() { |
182 | | - return Set.copyOf(methods); |
183 | | - } |
| 180 | + Set<HttpOperation> methods() { |
| 181 | + return Set.copyOf(methods); |
| 182 | + } |
184 | 183 |
|
185 | | - public Operation get() { |
186 | | - return get; |
187 | | - } |
| 184 | + public Operation get() { |
| 185 | + return get; |
| 186 | + } |
188 | 187 |
|
189 | | - public Operation post() { |
190 | | - return post; |
191 | | - } |
| 188 | + public Operation post() { |
| 189 | + return post; |
| 190 | + } |
192 | 191 |
|
193 | | - public Operation put() { |
194 | | - return put; |
195 | | - } |
| 192 | + public Operation put() { |
| 193 | + return put; |
| 194 | + } |
196 | 195 |
|
197 | | - public Operation delete() { |
198 | | - return delete; |
199 | | - } |
| 196 | + public Operation delete() { |
| 197 | + return delete; |
| 198 | + } |
200 | 199 |
|
201 | | - public Operation patch() { |
202 | | - return patch; |
203 | | - } |
| 200 | + public Operation patch() { |
| 201 | + return patch; |
| 202 | + } |
204 | 203 |
|
205 | | - public Operation head() { |
206 | | - return head; |
207 | | - } |
| 204 | + public Operation head() { |
| 205 | + return head; |
| 206 | + } |
208 | 207 |
|
209 | | - public Operation options() { |
210 | | - return options; |
211 | | - } |
| 208 | + public Operation options() { |
| 209 | + return options; |
| 210 | + } |
212 | 211 |
|
213 | | - @Override |
214 | | - public boolean equals(Object obj) { |
215 | | - if (obj == this) return true; |
216 | | - if (obj == null || obj.getClass() != this.getClass()) return false; |
217 | | - var that = (PathItem) obj; |
218 | | - return Objects.equals(this.get, that.get) && |
219 | | - Objects.equals(this.post, that.post) && |
220 | | - Objects.equals(this.put, that.put) && |
221 | | - Objects.equals(this.delete, that.delete) && |
222 | | - Objects.equals(this.patch, that.patch) && |
223 | | - Objects.equals(this.head, that.head) && |
224 | | - Objects.equals(this.options, that.options); |
225 | | - } |
| 212 | + @Override |
| 213 | + public boolean equals(Object obj) { |
| 214 | + if (obj == this) return true; |
| 215 | + if (obj == null || obj.getClass() != this.getClass()) return false; |
| 216 | + var that = (PathItem) obj; |
| 217 | + return Objects.equals(this.get, that.get) |
| 218 | + && Objects.equals(this.post, that.post) |
| 219 | + && Objects.equals(this.put, that.put) |
| 220 | + && Objects.equals(this.delete, that.delete) |
| 221 | + && Objects.equals(this.patch, that.patch) |
| 222 | + && Objects.equals(this.head, that.head) |
| 223 | + && Objects.equals(this.options, that.options); |
| 224 | + } |
226 | 225 |
|
227 | | - @Override |
228 | | - public int hashCode() { |
229 | | - return Objects.hash(get, post, put, delete, patch, head, options); |
230 | | - } |
| 226 | + @Override |
| 227 | + public int hashCode() { |
| 228 | + return Objects.hash(get, post, put, delete, patch, head, options); |
231 | 229 | } |
| 230 | + } |
232 | 231 |
|
233 | 232 | @JsonIgnoreProperties(ignoreUnknown = true) |
234 | 233 | record HttpOperation(String method, Operation operation) {} |
|
0 commit comments