Closed thomasbach-dev closed 2 years ago
@joelfisch Should I also update the generated code in the example directory? If so, how should I do this?
Thank you for creating the PR.
It would be helpful if you could update the example
folder with the new code. You can just run the generator with the options -o example/generatedCode specifications/petstore.yaml
but be aware that the repository contains a default openapi-configuration.yml
which will be picked up automatically if you do not rename or remove it (or provide another configuration). Maybe it would be helpful if we created a file called example-configuration.yml
or something like this which contains the following content:
specification: specifications/petstore.yaml
outputDir: example/generatedCode
Then you could just run the generator with --configuration example-configuration.yml
. Please note that the generated code will contain many other changes as well because I neglected the updating of the example in the past.
Another thing: The golden files are currently not equivalent to the code generated (or in the case of Common.hs
just copied). You can update this using .circleci/test_golden update
to get the exact result.
Thank you for your help!
I think I addressed all things mentioned above. I reversed the commit history to address your issues first and put my changes on top of them. I also added a small section to the README with instructions how to update examples and golden tests.
Ok, I incorporated your suggestions above.
Note that I also added *.hs-boot
files in the example
directory. Ping me if these should be dropped again and rather be ignored.
Ok, I incorporated your suggestions above. Note that I also added
*.hs-boot
files in theexample
directory. Ping me if these should be dropped again and rather be ignored.
That is absolutely correct. This looks good and I'll merge it. Thanks!
The previous implementation using
B8.unpack
andB8.pack
handled UTF-8 characters wrong. For example, using the characterî
(i-circumflex) in the generated stripeapi library I got:Invalid UTF-8 characters found in POST body
as
B8.pack
would not convert the character into UTF-8.I changed the implementation to use
encodeUtf8
anddecodeUtf8
fromData.Text.Encoding
.This is the upstream fix for https://github.com/Haskell-OpenAPI-Code-Generator/Stripe-Haskell-Library/issues/9