You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating this issue in swagger-core based on related issue previously raised on spray-swagger (gettyimages/spray-swagger#31).
Consider the Scala example: @apimodel(description = "Options of boxed types produces an Object ref instead of correct type")
case class BoxedTypesIssue31(stringSeq: Seq[String],
stringOpt: Option[String],
@(ApiModelProperty @field)(value = "Integers in a Sequence Box") intSeq: Seq[Int],
@(ApiModelProperty @field)(value = "Integer in an Option Box") intOpt: Option[Int],
justInt: Int)
Using swagger-core to generate the Swagger Spec results in:
{
"description": "Options of boxed types produces an Object ref instead of correct type",
"id": "BoxedTypesIssue31",
"properties": {
"intOpt": {
"$ref": "Object",
"description": "Integer in an Option Box"
},
"intSeq": {
"description": "Integers in a Sequence Box",
"items": {
"$ref": "Object"
},
"type": "array"
},
"justInt": {
"format": "int32",
"type": "integer"
},
"stringOpt": {
"type": "string"
},
"stringSeq": {
"items": {
"type": "string"
},
"type": "array"
}
}
}
The attributes justInt, stringOpt, and stringSeq are represented as desired.
The attributes intOpt and IntSeq are not. The boxed value is indicated as "$ref": "Object" instead of "type":"integer".
The desired Swagger Spec is:
{
"description": "Options of boxed types produces an Object ref instead of correct type, but can be overcome with dataType",
"id": "BoxedTypesIssue31WithDataType",
"properties": {
"intOpt": {
"description": "Integer in an Option Box",
"format": "int32",
"type": "integer"
},
"intSeq": {
"description": "Integers in a Sequence Box",
"items": {
"format": "int32",
"type": "integer"
},
"type": "array"
},
"justInt": {
"format": "int32",
"type": "integer"
},
"stringOpt": {
"type": "string"
},
"stringSeq": {
"items": {
"type": "string"
},
"type": "array"
}
}
}
I have some code that I will submit as a pull request that resolves this issue (to my satisfaction).
The text was updated successfully, but these errors were encountered:
gorgonblot
pushed a commit
to gorgonblot/swagger-core
that referenced
this issue
Nov 13, 2014
Creating this issue in swagger-core based on related issue previously raised on spray-swagger (gettyimages/spray-swagger#31).
Consider the Scala example:
@apimodel(description = "Options of boxed types produces an Object ref instead of correct type")
case class BoxedTypesIssue31(stringSeq: Seq[String],
stringOpt: Option[String],
@(ApiModelProperty @field)(value = "Integers in a Sequence Box") intSeq: Seq[Int],
@(ApiModelProperty @field)(value = "Integer in an Option Box") intOpt: Option[Int],
justInt: Int)
Using swagger-core to generate the Swagger Spec results in:
{
"description": "Options of boxed types produces an Object ref instead of correct type",
"id": "BoxedTypesIssue31",
"properties": {
"intOpt": {
"$ref": "Object",
"description": "Integer in an Option Box"
},
"intSeq": {
"description": "Integers in a Sequence Box",
"items": {
"$ref": "Object"
},
"type": "array"
},
"justInt": {
"format": "int32",
"type": "integer"
},
"stringOpt": {
"type": "string"
},
"stringSeq": {
"items": {
"type": "string"
},
"type": "array"
}
}
}
The attributes justInt, stringOpt, and stringSeq are represented as desired.
The attributes intOpt and IntSeq are not. The boxed value is indicated as "$ref": "Object" instead of "type":"integer".
The desired Swagger Spec is:
{
"description": "Options of boxed types produces an Object ref instead of correct type, but can be overcome with dataType",
"id": "BoxedTypesIssue31WithDataType",
"properties": {
"intOpt": {
"description": "Integer in an Option Box",
"format": "int32",
"type": "integer"
},
"intSeq": {
"description": "Integers in a Sequence Box",
"items": {
"format": "int32",
"type": "integer"
},
"type": "array"
},
"justInt": {
"format": "int32",
"type": "integer"
},
"stringOpt": {
"type": "string"
},
"stringSeq": {
"items": {
"type": "string"
},
"type": "array"
}
}
}
I have some code that I will submit as a pull request that resolves this issue (to my satisfaction).
The text was updated successfully, but these errors were encountered: