swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Support List in annotations and remove 'multiValueResponse'

Open ayush opened this issue 14 years ago • 5 comments

ayush avatar Jul 09 '12 18:07 ayush

Suggest we follow the implementation for other languages and parse the responseClass as a string such that List[Pet] will correspond to a list of pets, with support for the containers in the datatypes (https://github.com/wordnik/swagger-core/wiki/Datatypes) section of the wiki

fehguy avatar Oct 31 '12 06:10 fehguy

A possible proper solution - http://jackson.codehaus.org/1.7.0/javadoc/org/codehaus/jackson/type/TypeReference.html Note the link in the class description.

webron avatar Nov 11 '12 21:11 webron

Additional to issue #71.

Using java, if I set responseClass=Foo, and define Foo as below

public class Foo extends SuperFoo<Bar> {
}

I get this error

[error] c.w.s.p.HelpApi - Unable to load model documentation for Foo
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariabl
eImpl cannot be cast to java.lang.Class
        at com.wordnik.swagger.core.ApiPropertiesReader$.getDataType(SpecReader.
scala:84) ~[swagger-core_2.9.1-1.2.0.jar:1.2.0]
        at com.wordnik.swagger.core.ApiPropertiesReader$.getDataType(SpecReader.
scala:70) ~[swagger-core_2.9.1-1.2.0.jar:1.2.0]
        at com.wordnik.swagger.jsonschema.ApiModelParser.parsePropertyAnnotation
s(SwaggerJsonSchemaProvider.scala:150) ~[swagger-core_2.9.1-1.2.0.jar:1.2.0]
        at com.wordnik.swagger.jsonschema.ApiModelParser.com$wordnik$swagger$jso
nschema$ApiModelParser$$parseMethod(SwaggerJsonSchemaProvider.scala:96) ~[swagge
r-core_2.9.1-1.2.0.jar:1.2.0]
        at com.wordnik.swagger.jsonschema.ApiModelParser$$anonfun$parseRecurrsiv
e$1.apply(SwaggerJsonSchemaProvider.scala:79) ~[swagger-core_2.9.1-1.2.0.jar:1.2
.0]
        at com.wordnik.swagger.jsonschema.ApiModelParser$$anonfun$parseRecurrsiv
e$1.apply(SwaggerJsonSchemaProvider.scala:77) ~[swagger-core_2.9.1-1.2.0.jar:1.2
.0]

I am using

  • Play 2.0.4 (java)
  • "com.wordnik" %% "swagger-play2" % "1.2.0",

peter-fu avatar Dec 31 '12 04:12 peter-fu

Hrm, seem to have done the pull request wrong. Issue #101 should have been created as a pull request to resolve this issue.

-Mike

dekmetzi avatar Jan 04 '13 15:01 dekmetzi

This is handled in 1.2.1-SNAPSHOT.

fehguy avatar Jan 14 '13 18:01 fehguy