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

[BUG] Cannot generate server with invokePackage=Websupport\\InvoiceValidation #2402

Closed
4 of 6 tasks
FilipBenco opened this issue Mar 14, 2019 · 5 comments · Fixed by #2604
Closed
4 of 6 tasks

[BUG] Cannot generate server with invokePackage=Websupport\\InvoiceValidation #2402

FilipBenco opened this issue Mar 14, 2019 · 5 comments · Fixed by #2604

Comments

@FilipBenco
Copy link

FilipBenco commented Mar 14, 2019

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used? 3.2 / 3.3 / 4.0
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

I cannot generate namespace: Websupport\InvoiceValidation for any php server version.

And I received error:

openapi-generator version
OpenAPI declaration file content or url

OpanAPI file is in this bug irrelevant

Command line used for generation
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.0.0-beta2 generate -i /local/openapi.json -g php-slim -o /local --invoker-package Websupport\\InvoiceValidation

Output:

Exception in thread "main" java.lang.RuntimeException: Could not generate model 'Health'
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:498)
        at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:897)
        at org.openapitools.codegen.cmd.Generate.run(Generate.java:354)
        at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:61)
Caused by: java.util.regex.PatternSyntaxException: Illegal/unsupported escape sequence near index 12
^Websupport\InvoiceValidation\\*(.+)
            ^
        at java.util.regex.Pattern.error(Pattern.java:1955)
        at java.util.regex.Pattern.escape(Pattern.java:2471)
        at java.util.regex.Pattern.atom(Pattern.java:2198)
        at java.util.regex.Pattern.sequence(Pattern.java:2130)
        at java.util.regex.Pattern.expr(Pattern.java:1996)
        at java.util.regex.Pattern.compile(Pattern.java:1696)
        at java.util.regex.Pattern.<init>(Pattern.java:1351)
        at java.util.regex.Pattern.compile(Pattern.java:1028)
        at java.util.regex.Pattern.matches(Pattern.java:1133)
        at java.lang.String.matches(String.java:2121)
        at org.openapitools.codegen.languages.PhpSlimServerCodegen.modelFileFolder(PhpSlimServerCodegen.java:103)
        at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:306)
        at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:487)
        ... 3 more

Steps to reproduce

Just type and use your own yaml or json openapi file.

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v4.0.0-beta2 generate -i /local/openapi.json -g php-slim -o /local --invoker-package Websupport\\InvoiceValidation

Expected output should be all classes under namespace: Websupport\InvoiceValidation

Related issues/PRs
Suggest a fix
@auto-labeler
Copy link

auto-labeler bot commented Mar 14, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@ackintosh
Copy link
Contributor

@FilipBenco Thanks for this issue!

cc Technical Committee: @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ybelenko (2018/07), @renepardon (2018/12)

@vdelau
Copy link

vdelau commented Apr 1, 2019

I can confirm this bug, with latest 4.0 SNAPSHOT. I used a JSON config file with "Package\\Subpackage" and "Package\u005CSubpackage", both leading to the regexp failure. (And yes, choosing the backslash as a namespace separator might not have been the smartest choice ever of the PHP team.... ;) )

Same problem in 3.4 SNAPSHOT. Using a single element namespace works.

@ackintosh
Copy link
Contributor

@vdelau Thanks for providing the example which reproduce the issue. I'm working on this issue. 💨

@ackintosh
Copy link
Contributor

@FilipBenco @vdelau #2604 has been merged into master! Please give it a try with the latest docker image.

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

Successfully merging a pull request may close this issue.

3 participants