Hi, 

I am using spring boot with swagger *springfox*-swagger2 i.e. My project is 
fully annotated in order to generate/view swagger definition as per the 
swagger standard (e.g. 

@ApiResponse,
@ApiOperation, etc).


I am trying to add @Pattern (javax.validation.constraints.Pattern) in order 
to validate each field for the incoming JSON data. However, this change is 
not shown in the swagger definition generated when I access 
https://localhost:8080/prjname/api-docs

*Java code example:*

/**

* Get amount

* *@return* amount

**/

@ApiModelProperty(required = *true*, value = "")

@NotNull

@Pattern(regexp="^\\d{1,5}$", message="Amount regex")

*public* String getAmount() {

*return* amount;

}


*Swagger output:*

"InstAmount": {
   "type": "object",
   "required": ["Amount",
   "Currency"],
   "properties": {
    "Amount": {
     "type": "string"
    },
    "Currency": {
     "type": "string",
     "description": "blah"
    }
   },
   "description": "blah"
  },



Does anyone else have similar problem? Also I am correct in generating the 
swagger definition for my project using the above method?

Is there any other standard way of validating fields in swagger generated 
spring boot project?

Thanks











-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to