Skip to content

[PHP] add AbstractPhpCodegen to be as the base class of PHP-related generators#3310

Merged
wing328 merged 10 commits intoswagger-api:masterfrom
abcsun:php-base-generator
Aug 1, 2016
Merged

[PHP] add AbstractPhpCodegen to be as the base class of PHP-related generators#3310
wing328 merged 10 commits intoswagger-api:masterfrom
abcsun:php-base-generator

Conversation

@abcsun
Copy link
Copy Markdown
Contributor

@abcsun abcsun commented Jul 6, 2016

No description provided.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 7, 2016

For #3227

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 7, 2016

cc @arnested


// additionalProperties.put("escapedInvokerPackage", invokerPackage.replace("\\", "\\\\"));

// // make api and model doc path available in mustache template
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think apiDocPath and modelDocPath are still used in PHP API client documentation (markdown) so we should keep it.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 20, 2016

@abcsun when you've time, can you help do a rebase on the latest master to resolve the merge conflicts?

@abcsun
Copy link
Copy Markdown
Contributor Author

abcsun commented Jul 21, 2016

@wing328 please review

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 28, 2016

I did some tests with PHP API client, Slim, Silex, Lumen and found 1 issue.

If I run the following command:

   java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
   -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml \
   -l lumen \
   -o /var/tmp/lumen/ 

it shows the following error:

[main] WARN io.swagger.codegen.languages.AbstractPhpCodegen - Return (reserved word) cannot be used as model name. Renamed to ModelReturn
[main] WARN io.swagger.codegen.languages.AbstractPhpCodegen - Return (reserved word) cannot be used as model name. Renamed to ModelReturn
[main] ERROR io.swagger.codegen.AbstractGenerator - null/api.mustache (No such file or directory)
[main] ERROR io.swagger.codegen.AbstractGenerator - can't load template null/api.mustache
Exception in thread "main" java.lang.RuntimeException: Could not generate api file for 'Fake'
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:478)
    at io.swagger.codegen.cmd.Generate.run(Generate.java:223)
    at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:36)
Caused by: java.lang.RuntimeException: can't load template null/api.mustache
    at io.swagger.codegen.AbstractGenerator.readTemplate(AbstractGenerator.java:50)
    at io.swagger.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:643)
    at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:437)
    ... 2 more

./bin/lumen-petstore-server.sh works fine as it's using -tmodules/swagger-codegen/src/main/resources/lumen`.

@abcsun please let me know if you need help fixing the issue.

@abcsun
Copy link
Copy Markdown
Contributor Author

abcsun commented Aug 1, 2016

@wing328 Forgot to set the templateDir in LumenServerCodegen, it has be fixed.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Aug 1, 2016

@abcsun thanks for the fix. It works for me now.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants