Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG][Haskell] Fix returning NoContent #9830

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

mgajda
Copy link
Contributor

@mgajda mgajda commented Jun 22, 2021

Verbs with no content returned are now shown as having return type of (). This makes servant to try to parse resulting object.
Thus replacement with NoContent type fixes the issue.

Fixes: #9829

@wing328 @jimschubert @burberius

@mgajda
Copy link
Contributor Author

mgajda commented Jun 22, 2021

Please note that failing tests are on C# code only.
Is it fragile CI?

@wing328
Copy link
Member

wing328 commented Jun 26, 2021

Tested locally with updated samples and the result is good:

[INFO] --- exec-maven-plugin:1.6.0:exec (compile-test) @ HaskellServantServerTests ---
;openapi-petstore-0.1.0.0: unregistering (local file changes: lib/OpenAPIPetstore/API.hs)
openapi-petstore> configure (lib)
Configuring openapi-petstore-0.1.0.0...
openapi-petstore> build (lib)
Preprocessing library for openapi-petstore-0.1.0.0..
Building library for openapi-petstore-0.1.0.0..
[1 of 2] Compiling OpenAPIPetstore.Types
[2 of 2] Compiling OpenAPIPetstore.API
openapi-petstore> copy/register
Installing library in /Users/williamcheng/Code/openapi-generator/samples/server/petstore/haskell-servant/.stack-work/install/x86_64-osx/83049dd954ab3eb224bb8bb53f8b4cb9c5d21f487e07dc4cb446560830507f4a/8.6.5/lib/x86_64-osx-ghc-8.6.5/openapi-petstore-0.1.0.0-6jIYP8FqYVJIycXmp8ztms
Registering library for openapi-petstore-0.1.0.0..

@wing328 wing328 merged commit 1cd1001 into OpenAPITools:master Jun 26, 2021
@wing328 wing328 added this to the 5.2.0 milestone Jun 26, 2021
ivanbakel added a commit to ivanbakel/openapi-generator that referenced this pull request Jul 8, 2021
Relevant issue: OpenAPITools#9901

The haskell-http-client generator tries to generate a polymorphic return
type for endpoints which don't return anything in the success case, but
still produce content in other cases. This means that these endpoints
hit a decoding error in the success case, because there is no content to
decode.

This changes the behaviour so that endpoints that don't return anything
are *always* generated as returning NoContent, and never try to decode
the response. This change is based on a similar one for the
haskell-servant generator, which can be found at:

OpenAPITools#9830

which resolved a similar issue for that generator.
@wing328 wing328 changed the title [BUG][Haskell]Fix returning NoContent [BUG][Haskell] Fix returning NoContent Jul 9, 2021
jonschoning pushed a commit that referenced this pull request Jul 15, 2021
…ield NoContent (#9916)

* Make endpoints which don't return anything yield NoContent

Relevant issue: #9901

The haskell-http-client generator tries to generate a polymorphic return
type for endpoints which don't return anything in the success case, but
still produce content in other cases. This means that these endpoints
hit a decoding error in the success case, because there is no content to
decode.

This changes the behaviour so that endpoints that don't return anything
are *always* generated as returning NoContent, and never try to decode
the response. This change is based on a similar one for the
haskell-servant generator, which can be found at:

#9830

which resolved a similar issue for that generator.

* Update samples after haskell-http-client NoContent change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG][Haskell]Faulty generation for responses with no content
2 participants