Skip to content

Commit 1baffbf

Browse files
committed
Predictable order for consumes and produces.
1 parent 7e5f614 commit 1baffbf

File tree

1 file changed

+8
-8
lines changed
  • modules/swagger-jaxrs/src/main/java/io/swagger/jaxrs

1 file changed

+8
-8
lines changed

modules/swagger-jaxrs/src/main/java/io/swagger/jaxrs/Reader.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,20 +326,20 @@ private Swagger read(Class<?> cls, String parentPath, String parentMethod, boole
326326

327327
String[] apiConsumes = consumes;
328328
if (parentConsumes != null) {
329-
Set<String> both = new HashSet<String>(Arrays.asList(apiConsumes));
330-
both.addAll(new HashSet<String>(Arrays.asList(parentConsumes)));
329+
Set<String> both = new LinkedHashSet<String>(Arrays.asList(apiConsumes));
330+
both.addAll(new LinkedHashSet<String>(Arrays.asList(parentConsumes)));
331331
if (operation.getConsumes() != null) {
332-
both.addAll(new HashSet<String>(operation.getConsumes()));
332+
both.addAll(new LinkedHashSet<String>(operation.getConsumes()));
333333
}
334334
apiConsumes = both.toArray(new String[both.size()]);
335335
}
336336

337337
String[] apiProduces = produces;
338338
if (parentProduces != null) {
339-
Set<String> both = new HashSet<String>(Arrays.asList(apiProduces));
340-
both.addAll(new HashSet<String>(Arrays.asList(parentProduces)));
339+
Set<String> both = new LinkedHashSet<String>(Arrays.asList(apiProduces));
340+
both.addAll(new LinkedHashSet<String>(Arrays.asList(parentProduces)));
341341
if (operation.getProduces() != null) {
342-
both.addAll(new HashSet<String>(operation.getProduces()));
342+
both.addAll(new LinkedHashSet<String>(operation.getProduces()));
343343
}
344344
apiProduces = both.toArray(new String[both.size()]);
345345
}
@@ -905,9 +905,9 @@ private Operation parseMethod(Class<?> cls, Method method, List<Parameter> globa
905905
Response response = new Response().description(SUCCESSFUL_OPERATION);
906906
operation.defaultResponse(response);
907907
}
908-
908+
909909
processOperationDecorator(operation, method);
910-
910+
911911
return operation;
912912
}
913913

0 commit comments

Comments
 (0)