If it’s Spring boot, then you have to use Springfox (can’t use swagger-core directly).
I don’t know if Springfox parses constraint annotations but it does not depend on swagger-core for that business logic. Would suggest filing a ticket with Springfox. From: <[email protected]> on behalf of Matt Goodwin <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Tuesday, April 10, 2018 at 00:16 To: "[email protected]" <[email protected]> Subject: Re: Swagger-core Java Add constraints to a List of Strings REST framework is Spring boot On 9 Apr 2018, at 21:51, Ron Ratovsky <[email protected]> wrote: That doesn’t answer my question though, and there’s a reason I ask. From: <[email protected]> on behalf of Matt Goodwin <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Monday, April 9, 2018 at 23:17 To: Swagger <[email protected]> Subject: Re: Swagger-core Java Add constraints to a List of Strings i have also used the maven swagger plugin and the gradle swagger plugin to both generate the swagger json file and they all return the swagger json without the minLength and Pattern on the Items attribute On Monday, 9 April 2018 21:05:47 UTC+1, Ron wrote: This doesn’t make sense. Either you need to use Springfox or you need to use swagger-core, they serve different frameworks. Which REST framework do you use? From: <[email protected]> on behalf of Matt Goodwin <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Monday, April 9, 2018 at 22:56 To: Swagger <[email protected]> Subject: Re: Swagger-core Java Add constraints to a List of Strings ive tried without spring fox and its still the same problem :( On Monday, 9 April 2018 20:04:47 UTC+1, Ron wrote: If you’re using springfox – you need to check with them by filing a ticket directly with the project. From: <[email protected]> on behalf of Matt Goodwin <[email protected]> Reply-To: "[email protected]" <[email protected]> Date: Monday, April 9, 2018 at 21:40 To: Swagger <[email protected]> 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 [email protected]. 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 [email protected]. 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 [email protected]. 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 [email protected]. 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 [email protected]. 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
