swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

Pattern must follow the Perl /pattern/modifiers convention. [a-zA-Z0-9_-]+ is not valid

Open Formartha opened this issue 6 years ago • 12 comments

Hello, I'm trying to parse down a api.json schema that was provided with using Python as an input lang. however I fail to do it due to the error mentioned in the headline.

how shall I proceed with debugging it?

Formartha avatar Jul 18 '19 11:07 Formartha

hello @Formartha what pattern are you currently using?

HugoMario avatar Jul 18 '19 17:07 HugoMario

Hi @HugoMario, thanks for taking the time to response. That's the swagger schema I'm using.

{ "CmsTenantEntry" : { "type" : "object", "required" : [ "credentialsName", "endpoint", "locationUrl", "name", "type" ], "properties" : { "name" : { "type" : "string", "description" : "Unique logical name", "pattern" : "[a-zA-Z0-9_-]+" }, "type" : { "type" : "string", "description" : "Endpoint type", "pattern" : "[a-zA-Z0-9_-]+" }, "endpoint" : { "type" : "string", "description" : "Endpoint URI", "pattern" : "[a-zA-Z0-9_:/.-]+" }, "credentialsName" : { "type" : "string", "description" : "Logical identifier of credentials entry", "pattern" : "[a-zA-Z0-9_-]+" }, "datacenterId" : { "type" : "string", "description" : "Data center identifier", "pattern" : "[a-zA-Z0-9_-]+" }, "locationUrl" : { "type" : "string", "description" : "Location URL", "pattern" : "[a-zA-Z0-9_:/.-?#]+" } } }

Formartha avatar Jul 18 '19 17:07 Formartha

any news? :(

Formartha avatar Jul 21 '19 13:07 Formartha

hey @Formartha , yea, sorry for delay, i checked the error and seems to be already handled, what codegen version are you currently using?

HugoMario avatar Jul 22 '19 16:07 HugoMario

@HugoMario @Formartha I have the same issue. Reproducible on v2.4.7. But it works on 2.3.1

luber avatar Jul 25 '19 17:07 luber

weird, anyway, i'm going to assign it to myself and take a time to handled this

HugoMario avatar Sep 03 '19 20:09 HugoMario

I have this issue in 3.0.23, too.

pourquoi42 avatar Nov 23 '20 15:11 pourquoi42

Hello, As mentioned by @pourquoi42 I also face same issue using pattern in versions 3.0.22 and 3.0.23 as well.

Is it a bug? Because the pattern itself is valid but it throws java.lang.IllegalArgumentException: Pattern must follow the Perl /pattern/modifiers convention. ^$|[\w-]{4,32} is not valid. Please help solving this problem.

rajnamitha avatar Dec 10 '20 22:12 rajnamitha

Please ignore my above comment, I was able to get it working

rajnamitha avatar Dec 10 '20 23:12 rajnamitha

@rajnamitha and not writing how did you fixed that?

Dovchik avatar Jun 02 '23 14:06 Dovchik

Someone found a solution for this?

daniel-tribal avatar Oct 28 '23 00:10 daniel-tribal

Hi @Dovchik, I used "/" at the beginning of the pattern to make it work. This was only to run swagger codegen and then change to original pattern. So it is not a proper solution, hence didn't post it.

rajnamitha avatar Oct 28 '23 06:10 rajnamitha