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

API reference: clarify optional vs required properties and parameters #478

Open
josephjclark opened this issue Apr 23, 2024 · 0 comments
Open

Comments

@josephjclark
Copy link
Contributor

josephjclark commented Apr 23, 2024

Our JSDoc templates don't do a good job of making it clear what properties or parameters are required, and what are optional.

In the JSDoc spec, you declare an optional property or parameter in square brackets, like this:

* @param {string} [color]
* @property {string} [nickName]

But if you look at our documentation, all we do is display the property in square brackets, and who knows what that means?

image

Sometimes we explicitly say things are (Optional) in the description.:

image

This is kinda fine but we're not consistent. Also the context is different. When describing parameters, the parameters are required unless otherwise stated. But when describing an object, I'd say the properties are OPTIONAL unless otherwise stated (because objects are usually called options and if they were required, well, they wouldn't be options.

So for this issue, we need to:

  • Visualise required properties and params differently to optional ones (and agree the standard)
  • Consistently mark optional stuff the same way across our adaptors
  • Document our rules clearly somewhere (perhaps in a wiki referenced in the readme)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant