scribe
scribe copied to clipboard
Annotation example for boolean values doesn't work correctly
Scribe version
4.35.0
PHP version
8.3.3
Framework
Laravel
Framework version
10.43.0
Scribe config
type => "laravel"
theme => "elements"
static.output_path => "public/api/docs"
laravel.docs_url => "/api/docs"
auth.enabled => true
auth.default => true
auth.name => "apiKey"
What happened?
Attribute annontations do not render boolean examples correctly.
#[BodyParam('newsletter', 'boolean', description: 'Opt-in status for newsletter', required: true, example: true)]
#[BodyParam('newsletter', 'boolean', description: 'Opt-in status for newsletter', required: true, example: false)]
With true
or false
value as example, there is no example text in the documentation and for false
value the curl example is correct, but with the true
value, the curl example is set to null
Docs
- [X] I've checked the docs, the troubleshooting guide, and existing issues, but I didn't find a solution
#[QueryParam('is_api_user', 'boolean', '聯盟站點是否異業串接', false, 'true', ['true-是', 'false-否'])]
Sorry @mikeah2011 i am speaking about BodyParam not QueryParam.
If the example for a boolean BodyParam is set as string, like your comment 'true'
, the API json body sample use the type string instead of the type boolean.
In my example, the sample will be : { "newsletter": "true" }
instead of { "newsletter": true }
Yes, the string true cannot solve the problem perfectly. I have made a correction, please refer to it.