|
19 | 19 | import com.fasterxml.jackson.databind.JavaType; |
20 | 20 | import com.fasterxml.jackson.databind.type.TypeFactory; |
21 | 21 | import com.google.common.collect.Collections2; |
22 | | - |
23 | 22 | import io.swagger.annotations.Api; |
24 | 23 | import io.swagger.annotations.ApiImplicitParam; |
25 | 24 | import io.swagger.annotations.ApiImplicitParams; |
|
62 | 61 | import io.swagger.models.properties.MapProperty; |
63 | 62 | import io.swagger.models.properties.Property; |
64 | 63 | import io.swagger.models.properties.RefProperty; |
65 | | - |
66 | 64 | import org.apache.commons.lang3.StringUtils; |
67 | 65 | import org.slf4j.Logger; |
68 | 66 | import org.slf4j.LoggerFactory; |
|
73 | 71 | import javax.ws.rs.PathParam; |
74 | 72 | import javax.ws.rs.Produces; |
75 | 73 | import javax.ws.rs.QueryParam; |
76 | | - |
77 | 74 | import java.lang.annotation.Annotation; |
78 | 75 | import java.lang.reflect.Constructor; |
79 | 76 | import java.lang.reflect.Field; |
@@ -144,6 +141,14 @@ public Swagger read(Set<Class<?>> classes) { |
144 | 141 | } |
145 | 142 | } |
146 | 143 |
|
| 144 | + // process SwaggerDefinitions first - so we get tags in desired order |
| 145 | + for (Class<?> cls : classes) { |
| 146 | + SwaggerDefinition swaggerDefinition = cls.getAnnotation(SwaggerDefinition.class); |
| 147 | + if (swaggerDefinition != null) { |
| 148 | + readSwaggerConfig(cls, swaggerDefinition); |
| 149 | + } |
| 150 | + } |
| 151 | + |
147 | 152 | for (Class<?> cls : classes) { |
148 | 153 | read(cls); |
149 | 154 | } |
@@ -172,11 +177,6 @@ public Swagger read(Class<?> cls) { |
172 | 177 | } |
173 | 178 |
|
174 | 179 | protected Swagger read(Class<?> cls, String parentPath, String parentMethod, boolean readHidden, String[] parentConsumes, String[] parentProduces, Map<String, Tag> parentTags, List<Parameter> parentParameters) { |
175 | | - SwaggerDefinition swaggerDefinition = cls.getAnnotation(SwaggerDefinition.class); |
176 | | - if (swaggerDefinition != null) { |
177 | | - readSwaggerConfig(cls, swaggerDefinition); |
178 | | - } |
179 | | - |
180 | 180 | Api api = (Api) cls.getAnnotation(Api.class); |
181 | 181 | Map<String, SecurityScope> globalScopes = new HashMap<String, SecurityScope>(); |
182 | 182 |
|
|
0 commit comments