If you’re using springfox – you need to check with them by filing a ticket 
directly with the project.

 

 

From: <swagger-swaggersocket@googlegroups.com> on behalf of Matt Goodwin 
<matt.goodwin...@gmail.com>
Reply-To: "swagger-swaggersocket@googlegroups.com" 
<swagger-swaggersocket@googlegroups.com>
Date: Monday, April 9, 2018 at 21:40
To: Swagger <swagger-swaggersocket@googlegroups.com>
Subject: Swagger-core Java Add constraints to a List of Strings

 

Hi,  

 

Swagger-core v1.5.18

 

compile 'io.springfox:springfox-swagger2:2.8.0'
compile 'io.swagger:swagger-core:1.5.18'
compile 'io.swagger:swagger-annotations:1.5.18'
compile 'io.swagger:swagger-models:1.5.18'
compile 'io.springfox:springfox-swagger-ui:2.8.0'

 

I want to be able to add constraints to ensure that elements of a List are of a 
certain String length and of a particular pattern such as 

 

My original class is as follows:

 

private class MyRequest {
    @Size(max=10)
    private List<@Size(max = 10) @Pattern("^myPattern$") String> foo;
}

 

 

However, when checking the generated Swagger JSON, i was expecting... 

 

type: array
items:
  type: string
  minLength: 10
  pattern: ^myPattern$ 
 

but the items array only contained a type property

 

type: array
items:
  type: string
 

Is this possible and if so, how i can achieve this?

-- 
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 swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
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 swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to