swagger-api / swagger-api/swagger-codegen
Generate server stubs for PHP-SLIM not working for 3.x
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I tried to generate my server stubs with the PHP SLIM framework code and I get the following:
$ java -jar swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.json -l slim -o /c/Projects/test
Exception in thread "main" java.lang.RuntimeException: Can't load config class with name slim Available: dart
aspnetcore
csharp
csharp-dotnet2
go
go-server
dynamic-html
html
html2
java
jaxrs-cxf-client
jaxrs-cxf
inflector
jaxrs-cxf-cdi
jaxrs-spec
jaxrs-jersey
jaxrs-di
jaxrs-resteasy-eap
jaxrs-resteasy
micronaut
spring
nodejs-server
openapi
openapi-yaml
kotlin-client
kotlin-server
php
python
python-flask
r
ruby
scala
scala-akka-http-server
swift3
swift4
swift5
typescript-angular
typescript-axios
typescript-fetch
javascript
at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:31)
at io.swagger.codegen.v3.cli.SwaggerCodegen.main(SwaggerCodegen.java:96)
Caused by: java.lang.ClassNotFoundException: slim
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at io.swagger.codegen.v3.CodegenConfigLoader.forName(CodegenConfigLoader.java:29)
... 1 more
As you can see, there is no slim option in the list. The documentation says it should work.
If I run the same command against my 2x jar the command succeeds.
The problem is that 2x does not support Open API 3.0.3 and I need to support 3.0.3.
Swagger-codegen version
3.0.34
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at CodegenConfigLoader.java and SwaggerCodegen.main, which appear in the failure trace, and compare the documented PHP-SLIM generator with the available generator list. Reproduce the 3.0.34 command against the Petstore OpenAPI document; done means the slim option is recognized and server stubs generate successfully for OpenAPI 3.0.3.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, php
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100