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

feature/nullable #834

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Conversation

MertcanDinler
Copy link
Contributor

Support for nullable values for OpenApiSpecs.
If the parameter is not required, if it is specified to be nullable with the BodyParam attribute, or if there is a nullable rule in the validation, this field will be added to the OpenApiSpecs as nullable.

@MertcanDinler MertcanDinler changed the title eature/nullable feature/nullable Mar 28, 2024
@shalvah
Copy link
Contributor

shalvah commented May 1, 2024

I need to think about this a bit. I see the distinction, but I'm always skeptical about adding OpenAPI-only features. I daresay, for most devs in a dynamically-typed language like PHP, a required parameter is functionally equivalent to non-null (in most cases).

@liverocaisson
Copy link
Contributor

@MertcanDinler cc @shalvah
I tried also to implement a similar nullable fonctionnality when not required -> nullable : true
but tests don't pass. If someone can help.
#739

@jfoliveira
Copy link

@MertcanDinler cc @shalvah I tried also to implement a similar nullable fonctionnality when not required -> nullable : true but tests don't pass. If someone can help. #739

@liverocaisson added more suggestions to #739
Please have a look when you have a chance.

@shalvah shalvah mentioned this pull request Jun 10, 2024
1 task
@shalvah
Copy link
Contributor

shalvah commented Jun 10, 2024

Been busy, will take a look at these sometime this week or next.

@shalvah
Copy link
Contributor

shalvah commented Oct 3, 2024

Hey, sorry I didn't get back to this! I think I'll accept it. Note that, as you've PRed, this feature only works with the attribute and the validation rule, and only affects the OpenAPI output. This means:

  1. It doesn't work with the annotations (@bodyParam, ...)
  2. It doesn't change the HTML page output.

I think I'd like to change the second, but the first will probably stay as is for a while. In the meantime, I'll accept this, but label it "experimental". Thanks for your contribution!

@shalvah shalvah merged commit 4d4a44e into knuckleswtf:master Oct 3, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants