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

Support specifying Example: null in annotations #755

Merged

Conversation

liverocaisson
Copy link
Contributor

@liverocaisson liverocaisson commented Nov 1, 2023

Allow null parameter in the generation of API example specification

@bodyParam col_id integer required ID Example: null 
@bodyParam col_name string name Example: null

Example of use
We want to put null value in the database.
We want to pass null as ID to create a new ID. //presence of parameter required
We want to pass null instead of '' string.

@liverocaisson
Copy link
Contributor Author

liverocaisson commented Nov 1, 2023

@bodyParam col_name string name Example: null
The example above, null is ignored and not written in the specification.
It's seems that if we don't put required, the example is ignored.

How to not ignore non-required, intentional null example ?

Can you give me some guidance about the file to modify to allow this logic.

@liverocaisson
Copy link
Contributor Author

liverocaisson commented Nov 1, 2023

I found why intentional null example are ignored.

I have added a if condition to not ignore null example, if the example is intentionally written as the example below

@bodyParam col_name string name Example: null

src/Extracting/Extractor.php

@shalvah shalvah added the triage label Nov 5, 2023
@shalvah shalvah changed the title [update] Allow Intentionnal null value in Example Support specifying Example: null in annotations Nov 19, 2023
@shalvah
Copy link
Contributor

shalvah commented Nov 19, 2023

Thanks!

@shalvah shalvah merged commit 6ecd6a8 into knuckleswtf:master Nov 19, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants