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

Add docstrings for version service #9411

Merged
merged 6 commits into from
Aug 11, 2023
Merged

Add docstrings for version service #9411

merged 6 commits into from
Aug 11, 2023

Conversation

pr7prashant
Copy link
Contributor

  • Added docstrings for version service

@github-actions
Copy link
Contributor

github-actions bot commented Jul 27, 2023

Messages
📖 ✨ Thanks for your contribution to Shields, @pr7prashant!

Generated by 🚫 dangerJS against 0f1c69a

Copy link
Member

@chris48s chris48s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for picking this up

services/version.js Outdated Show resolved Hide resolved
* For example, rangeStart(“^1.2.3”) would return “1.2.3” because it is the version string of the first comparator in the first set of the range object, which is >=1.2.3 and <2.0.0.
*
* @param {string} v - The semver range to evaluate
* @returns {string|null} The version string of the first comparator in the first set of the range object, or null if the range is not valid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When does this return null? I'd have thought an invalid semver range would throw TypeError: Invalid SemVer Range when we try to construct it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is still outstanding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

services/version.js Outdated Show resolved Hide resolved
services/version.js Show resolved Hide resolved
@calebcartwright calebcartwright added the documentation Developer and end-user documentation label Jul 31, 2023
@pr7prashant
Copy link
Contributor Author

Hey @chris48s, I've made all the suggested changes but I couldn't get the backticks to render as <code></code> in the docs so I used @example tag instead to make the code more discrete.

@chris48s
Copy link
Member

chris48s commented Aug 8, 2023

Cheers. There's one still to follow up on, I think: #9411 (comment)

I've made all the suggested changes but I couldn't get the backticks to render as in the docs so I used @example tag instead to make the code more discrete.

Using @example works fine 👍 but here's a working example using backticks and the rendered output:

  • /**
    * Helper function for assembling an array of OpenAPI path parameter objects
    * The code
    * ```
    * const params = pathParams(
    * { name: 'name1', example: 'example1' },
    * { name: 'name2', example: 'example2' },
    * )
    * ```
    * is equivilent to
    * ```
    * const params = [
    * pathParam({ name: 'name1', example: 'example1' }),
    * pathParam({ name: 'name2', example: 'example2' }),
    * ]
    * ```
    *
    * @param {...module:core/base-service/openapi~PathParamInput} params Input params
    * @returns {Array.<module:core/base-service/openapi~OpenApiParam>} Array of OpenAPI Parameter Objects
    * @see {@link module:core/base-service/openapi~pathParam}
    */
    function pathParams(...params) {
    return params.map(param => pathParam(param))
    }
  • http://contributing.shields.io/module-core_base-service_openapi.html#~pathParams

@pr7prashant
Copy link
Contributor Author

Oh my bad, I was using single backtick. It renders a code block in description but this does not render code block inside the @example tag. I hope the @example tag is fine. Please let me know if we need to change.

Here is an example how it looks in description vs @example with backticks:
image

@chris48s
Copy link
Member

yep - no worries. I think the way you've done with @example is fine. Thanks

@chris48s chris48s added this pull request to the merge queue Aug 11, 2023
Merged via the queue into badges:master with commit a94115f Aug 11, 2023
20 checks passed
@pr7prashant pr7prashant deleted the docstrings-version-service branch August 11, 2023 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Developer and end-user documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants