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

Response is always nullable under generateNullableReferenceTypes #302

Closed
christianhelle opened this issue Jan 26, 2024 Discussed in #211 · 2 comments · Fixed by #304
Closed

Response is always nullable under generateNullableReferenceTypes #302

christianhelle opened this issue Jan 26, 2024 Discussed in #211 · 2 comments · Fixed by #304
Assignees
Labels
bug Something isn't working

Comments

@christianhelle
Copy link
Owner

Discussed in #211

Originally posted by jods4 November 3, 2023
Given this basic OpenApi:

"get": {
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/response"
          }

And when option generateNullableReferenceTypes is true, then the following method is generated:

[Get("/")]
Task<Response?> Get();

Why is Response nullable? Is my OpenApi missing a property to indicate the response is always present?
When the API is successful (200) there is a Response object.

With this code generation I basically have to always bang ! my Refit responses.

@christianhelle christianhelle added the bug Something isn't working label Jan 26, 2024
@christianhelle christianhelle self-assigned this Jan 26, 2024
@christianhelle christianhelle changed the title Response is always nullable under generateNullableReferenceTypes? Response is always nullable under generateNullableReferenceTypes Jan 26, 2024
@christianhelle
Copy link
Owner Author

@all-contributors please add @jods4 for bugs

Copy link
Contributor

@christianhelle

I've put up a pull request to add @jods4! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant