OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.23k stars 6.43k forks source link

[BUG][Haskell] servant-client integration generates syntax error on the stripe spec. #2968

Open mbj opened 5 years ago

mbj commented 5 years ago

Bug Report Checklist

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.

auto-labeler[bot] commented 5 years ago

👍 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.

jonschoning commented 4 years ago

I just saw this bug now, unfortunately. I'll take a look, thanks for reporting.