OpenAPITools / OpenAPITools/openapi-generator
[BUG][Haskell] servant-client integration generates syntax error on the stripe spec.
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
- What's the version of OpenAPI Generator used?
- Have you search for related issues/PRs?
- What's the actual output vs expected output?
Description
Using the servant-client generator, code that has a syntax error gets generated.
openapi-generator version
4.0.0
OpenAPI declaration file content or url
https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json
Steps to reproduce
wget https://raw.githubusercontent.com/stripe/openapi/master/openapi/spec3.json
# that one fails as its not a valid spec
java -jar openapi-generator-cli-4.0.0.jar generate -i spec3.json -g haskell
# skipping validation
java -jar openapi-generator-cli-4.0.0.jar generate -i spec3.json--skip-validate-spec -g haskell
# stack build
[snip]
[1 of 2] Compiling Stripe.Types ( lib/Stripe/Types.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/Stripe/Types.o )
/home/mrh-dev/devel/test/lib/Stripe/Types.hs:603:55: error: parse error on input ‘;’
|
603 | { accountBusinessUnderscoreprofile :: Maybe AnyOf<accountBusinessProfile> -- ^ Optional information related to the business.
|
Other notes
The stripe spec is not valid, but AFAIK the generator skips over the invalid parts. So the syntax error could or could not relate to the "invalidness".
Related issues/PRs
could find none.
Suggest a fix
Sorry, my familiarity with this code base is too low to recommend a good one. I suspect that java syntax somehow leaks into the haskell gennerator, the escaped < and > could be java generics syntax.
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
Reproduce with openapi-generator-cli 4.0.0 using the Stripe spec, -g haskell, and --skip-validate-spec, then inspect the generated lib/Stripe/Types.hs around line 603. Compare the emitted declaration with valid Haskell syntax and verify that the generated project builds without the reported parse error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100