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

Naming conventions for properties in returned objects #13834

Open
queengooborg opened this issue Dec 2, 2021 · 2 comments
Open

Naming conventions for properties in returned objects #13834

queengooborg opened this issue Dec 2, 2021 · 2 comments
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API docs Issues or pull requests regarding the documentation of this project.

Comments

@queengooborg
Copy link
Contributor

In #12840, @ddbeck and @foolip had been discussing a convention for the properties in the objects returned by certain methods. Quoting the conversation here:

Since we don't have a guideline, maybe this is an opportunity to start from scratch? How about returns_audioCapabilities_property with the idea being that we could have a convention for object properties (like this one), types (like returns_DOMMatrix_type), and values (like returns_undefined_value).

We should probably put the word return in the description too. Returns <code>audioCapabilities</code> property?

Originally posted by @ddbeck in #12840 (comment)

More ideas on these lines, to cut down on the wordiness:

  • audioCapabilities in return value object
  • audioCapabilities in returned object
  • Returns object with audioCapabilities
  • Returns object with audioCapabilities property

Originally posted by @ddbeck in #12840 (comment)

This made me think of the possibility of %parameter%_property_returned as the standard key, if that sounds nice?

@queengooborg queengooborg added data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API docs Issues or pull requests regarding the documentation of this project. labels Dec 2, 2021
@foolip
Copy link
Contributor

foolip commented Dec 7, 2021

Which description do you prefer? I think we can just take the entry name based on that.

"audioCapabilities in returned object" looks best to me, since multiple of those can co-exist without any sense that they are contradictory. Having both "Returns object with a" and "Returns object with b" sound more like they're exclusive.

@ddbeck
Copy link
Collaborator

ddbeck commented Dec 8, 2021

"audioCapabilities in returned object" looks best to me

I think this is my preference too. I didn't consider the possible suggestion of exclusivity for the the "Returns object…" cases. I also prefer fewer words over more words, all other things being equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API docs Issues or pull requests regarding the documentation of this project.
Projects
None yet
Development

No branches or pull requests

3 participants