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

How to send NULL values? #857

Open
1 task done
mcpicoli opened this issue Jun 7, 2024 · 2 comments
Open
1 task done

How to send NULL values? #857

mcpicoli opened this issue Jun 7, 2024 · 2 comments
Labels
question Further information is requested

Comments

@mcpicoli
Copy link

mcpicoli commented Jun 7, 2024

Scribe version

4.34.0

Your question

How do I specify and send a NULL value as a possible input for a field?

For example, one of the parameters of my API accepts an integer or NULL for some user operation:

...something else...
     * @bodyParam user_id_for_verification int User ID for Verification. No-example
...something else...

Content-Type and Accept are both application/json. That is important since if data was sent using URLEncoded values, there wouldn't be this possibility unless (controversially) encoding NULL as %00 as a missing value for an existing parameter would mean "empty string" not NULL.

Sending a NULL value is completely different from omitting the value for the API being documented. A NULL value means "no user_id for verification" (maybe changing it from some previous integer value), omitting it means "do not change the user for verification".

How do I specify that this parameter accepts a valid integer or NULL as valid input?

When the documentation is generated...

  • If I omit the value, it is not sent;
  • If I send an integer, it is sent correctly;
  • If I send "null" (without quotes) it is not accepted, "Please enter a number." is shown;
  • If I send "null" (without quotes and changing the type of the field to string), it is sent as the "null" string.

Maybe I am missing something obvious?

P.S.: The same question may be extended to "How do I specify and send an empty string value for a field?"

Docs

@mcpicoli mcpicoli added question Further information is requested triage labels Jun 7, 2024
@shalvah
Copy link
Contributor

shalvah commented Jun 10, 2024

There's a PR to add a nullable feature. Does this meet your concerns? #834

@shalvah shalvah removed the triage label Jun 10, 2024
@mcpicoli
Copy link
Author

mcpicoli commented Jun 11, 2024

There's a PR to add a nullable feature. Does this meet your concerns? #834

Only if it is implemented into the HTML docs and Postman collection as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants