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

Pattern regex is not being picked by swagger for list of String #4049

Closed
router19 opened this issue Nov 19, 2021 · 2 comments
Closed

Pattern regex is not being picked by swagger for list of String #4049

router19 opened this issue Nov 19, 2021 · 2 comments

Comments

@router19
Copy link

I have added a below pattern validation for List of String. Though the pattern is picked up by swagger for String type variables while swagger does not pick a pattern for a list of strings.

My class looks like this:

public class Sample {

@Pattern(regexp="[a-zA-Z-]*")
private String key;

private List<@Pattern(regexp="[a-zA-Z]*") String values;

//getters and setters are written

}

The swagger output looks like :

"Sample":{
     "type" : "object"
     "properties" :{
         "key" :{
              "type" : "string",
             "pattern": "[a-zA-Z]*"
         },
         "values": {
                "type":"array",
                "items":{
                     "type":"string"
              }
        }
  }
}

Any help on how can we get Pattern added for List of String
I am using io.swagger version 1.5.19
validation API version -> validation-api-2.0.1

@gcatanese
Copy link
Contributor

I have submitted a PR #4151 to address this (I was indeed able to reproduce it with a unit test)

@frantuma
Copy link
Member

fixed in #4151, thanks!

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

No branches or pull requests

3 participants