OpenAPITools / OpenAPITools/openapi-generator
[BUG][Dart] Failed to generate package for Stripe library
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Both dart and dart-dio fails to generate the code for the stripe openapi.
https://github.com/stripe/openapi/tree/master/openapi
I have created a repo here with the commands. The validation does not return any problems with the file.
https://github.com/jamesblasco/stripe_openapi
openapi-generator version
5.1.0-SNAPSHOT
OpenAPI declaration file content or url
https://raw.githubusercontent.com/jamesblasco/stripe_openapi/main/spec3.yaml
Generation Details
openapi-generator generate -i spec3.yaml -g dart-dio -o stripe_openapi --enable-post-process-file \
--reserved-words-mappings=File=STPFile,Source=STPSource \
--import-mappings=File=STPFile,Source=STPSource \
--type-mappings=File=STPFile,Source=STPSource \
-c openapi_config.json
Steps to reproduce
Clone https://github.com/jamesblasco/stripe_openapi
Run sh generate.sh
Related issues/PRs
There are some related issues with the Stripe openapi in another languages
#8397 #8398 #7975 #6816 #2968
Error log
Exception: Cannot invoke "io.swagger.v3.oas.models.media.Schema.getProperties()" because "schema" is null
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1145)
at org.openapitools.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:1036)
at org.openapitools.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:561)
at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:878)
at org.openapitools.codegen.cmd.Generate.execute(Generate.java:440)
at org.openapitools.codegen.cmd.OpenApiGeneratorCommand.run(OpenApiGeneratorCommand.java:32)
at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:66)
Caused by: java.lang.NullPointerException: Cannot invoke "io.swagger.v3.oas.models.media.Schema.getProperties()" because "schema" is null
at org.openapitools.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:4349)
at org.openapitools.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:3777)
at org.openapitools.codegen.languages.DartClientCodegen.fromOperation(DartClientCodegen.java:559)
at org.openapitools.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:1113)
... 6 more
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
Clone the linked jamesblasco/stripe_openapi repository and run generate.sh to reproduce the failure. Start with DefaultCodegen.fromParameter, DartClientCodegen.fromOperation, and DefaultGenerator.processOperation, using spec3.yaml and the reported stack trace to follow the null schema. Done means generation succeeds for the supplied Stripe specification without the NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100