-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Arguments marked with @ModelAttribute were ignored (should have param…
…Type="form"). That caused crash in swagger-ui. baseModelPackage and additionaModelPackages were removed since there were unnecessary. All models are now adding on the go, that increased speed and amount of data sent to client (swagger ui).
- Loading branch information
Andrey Antonov
committed
Feb 21, 2014
1 parent
27dd93d
commit fa713bd
Showing
16 changed files
with
257 additions
and
293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
src/main/java/com/knappsack/swagger4springweb/parser/ApiModelParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
package com.knappsack.swagger4springweb.parser; | ||
|
||
import com.knappsack.swagger4springweb.util.ApiUtils; | ||
import com.knappsack.swagger4springweb.util.ModelUtils; | ||
import com.wordnik.swagger.model.Model; | ||
import org.springframework.web.bind.annotation.ResponseBody; | ||
|
||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Type; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class ApiModelParser { | ||
|
||
public Map<String, Model> getResponseBodyModels(Method method) { | ||
Map<String, Model> models = new HashMap<String, Model>(); | ||
private final Map<String, Model> models; | ||
|
||
public ApiModelParser(final Map<String, Model> models) { | ||
this.models = models; | ||
} | ||
|
||
public void parseResponseBodyModels(Method method) { | ||
if (method.getAnnotation(ResponseBody.class) != null) { | ||
Type type = method.getGenericReturnType(); | ||
|
||
ApiUtils.addModels(type, models); | ||
ModelUtils.addModels(type, models); | ||
} | ||
|
||
return models; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.