jsdoc-vuejs icon indicating copy to clipboard operation
jsdoc-vuejs copied to clipboard

[Bug] - can't set Required?

Open Elaniobro opened this issue 4 years ago • 5 comments

Awesome plugin, really liking how it works so far.

Not sure if this a bug, known or other, but I can't seem to set the Required? table cell in the @vue-props declaration.

/**
 * @vue-prop {('cube-grid'|'three-bounce')} [name='cube-grid'] - optional='Yes' - true - name of loader to use
 * @vue-prop {Number} [size=30] - [optional='Yes'] - size of loading icons width
 * @vue-prop {String} [bgColor=#000] - required='Yes' - hexadecimal color value for loader
 * @vue-prop {String} [bgColor=#000] - [required='Yes'] - hexadecimal color value for loader
*/

Nothing seems to work, and Required? is always No

Elaniobro avatar Aug 06 '20 16:08 Elaniobro

Hi, and thanks for your words.

I think you need to use this to make a property required:

/**
 * @vue-prop {String} bgColor - hexadecimal color value for loader
 */

Since it uses bgColor instead of [bgColor=#000], the property is now seen as required.

See https://github.com/Kocal/jsdoc-vuejs#usage and https://jsdoc.app/tags-param.html#optional-parameters-and-default-values for more information

Kocal avatar Aug 11 '20 11:08 Kocal

Thank you for your reply, how then would you set the default value, along side required? * @vue-prop {('cube-grid'|'three-bounce')} [name='cube-grid'] - name of loader to use Screen Shot 2020-08-11 at 3 25 55 PM

* @vue-prop {('cube-grid'|'three-bounce')} name - name of loader to use Screen Shot 2020-08-11 at 3 24 42 PM

I can't seem to get both to work, the bug, or I am doing something very wrong. Thanks!

Elaniobro avatar Aug 11 '20 19:08 Elaniobro

How can a Vue props can be required if it has a default value?

Kocal avatar Aug 12 '20 08:08 Kocal

@Kocal fair enough, but the documentation is then confusing since Required? says no. Would it not make more sense to then void the value e.g. -since the Default Value is present? Similar to how its show when Required? is Yes?

Elaniobro avatar Aug 12 '20 15:08 Elaniobro

I will be honest here and admit that I also find the documentation might benefit from being a little clearer on what part of that syntax designates what. I am currently doing a lot of trial and error . I got there eventually, but knowing that the default value needs to be sqashed in the square brackets with the name, whereas other bits are simply separated by spaces. The hyphens before "description" seem to be more of a stylistic best practice? I could easily remove them.

Programina avatar Jun 25 '21 15:06 Programina