Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0 Spec] Schema "properties" does not implement attribute "readOnly" #695

Closed
giuseppegreco opened this issue Sep 27, 2014 · 1 comment
Closed
Labels
Milestone

Comments

@giuseppegreco
Copy link

Schema "properties" does not implement attribute "readOnly". For example, the following code snippet does not compile...

import com.wordnik.swagger.annotations._

@ApiModel(value = "Account", description = "Represents an user account")
trait Account {

  @ApiModelProperty(value = "The identifier of the account", dataType = "string", readOnly = true, position = 1)
  def id: Option[String]
  ...
}

... and always produce the following error message:

  [error] /home/j3d/Projects/xxxxxx/modules/common/app/models/api/Account.scala:19: unknown annotation argument name: readOnly
  [error]   @ApiModelProperty(value = "The identifier of the account", dataType = "string", readOnly = true, position = 1)

Thanks,
j3d

@fehguy fehguy added the Bug label Dec 20, 2014
@fehguy fehguy added this to the v1.5.0-M1 milestone Dec 20, 2014
@fehguy fehguy added the P1 label Dec 23, 2014
@vandeti
Copy link
Contributor

vandeti commented Jan 2, 2015

Jackson currently has limited support for ignoring fields on deserialise only (see link below). Through a combination of JsonIgnore on field and setter and JsonProperty on getter you can get this kind of behaviour but it's more a trick then a feature. Even though this will get you the serialisation behaviour it will obviously not get you the correct swagger Model.

The swagger model converter uses the com.fasterxml.jackson.databind.AnnotationIntrospector to abstract the actual annotations being used (jaxb, Jackson or ModelAPI ). Unless the readOnly concept is added on that API (and then also in the jackson deserialiser), I see no clean way to add it to swagger given the current design.

see: FasterXML/jackson-databind#95

Kr,

Tim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants