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

Pattern support #249

Merged
merged 18 commits into from
Mar 2, 2022
Merged

Pattern support #249

merged 18 commits into from
Mar 2, 2022

Conversation

garrett-wade
Copy link
Contributor

@garrett-wade garrett-wade commented Mar 1, 2022

Adding support for custom comment pattern specification

This is initial enhancement to support the following issue readmeio/oas#603.

This enhancement:

  • added an optional pattern argument command-line argument with help text
  • added pattern attribute and get/set methods to Options object
  • added loadPattern method to Loader to load json file that contains specification of pattern
  • added section in swaggerInline in index file to handle adding the loaded pattern file to the options variable
  • ensured backwards compatibility if no pattern is specified
  • expanded test coverage to cover all changes

Testing

Refer to the can extract comments from custom pattern and custom file test in the extractor.test.js file to see a detailed test of the additional functionality.

- added pattern command-line arguement
- added pattern attribute to Options object
- added pattern command-line arguement with help text
- added pattern attribute and get/set methods to Options object
- added loadPattern method to Loader to load json file
- added section in swaggerInline in Indx to handle adding the loaded pattern file to options
- expanded test coverage to cover all changes
@erunion erunion added the enhancement New feature or request label Mar 1, 2022
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

Handful of nits, but overall this looks pretty solid! Thanks for picking this up.

Can you also re-run Prettier on your changes? You can run it with npx prettier --list-different --write "./**/**.{js}"

src/cli.js Outdated Show resolved Hide resolved
__tests__/extractor.test.js Outdated Show resolved Hide resolved
__tests__/extractor.test.js Outdated Show resolved Hide resolved
src/extractor.js Outdated Show resolved Hide resolved
src/extractor.js Outdated Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/loader.js Outdated Show resolved Hide resolved
garrett-wade and others added 5 commits March 1, 2022 15:44
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
@garrett-wade
Copy link
Contributor Author

@erunion Receiving following error when running prettier: [error] No files matching the pattern were found: "./**/**.{js}". Any thoughts here?

@erunion
Copy link
Member

erunion commented Mar 1, 2022

@garrett-wade I just pushed up c718583 that has a prettier script so you can run npm run prettier instead. Works locally for me so hopefully should for you.

@garrett-wade
Copy link
Contributor Author

@erunion was able to run

__tests__/loader.test.js Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
garrett-wade and others added 2 commits March 1, 2022 16:14
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

Sorry, I finally had a chance to run this locally and a found a couple things. These should be the last of the changes! Thanks again for this.

__tests__/loader.test.js Outdated Show resolved Hide resolved
__tests__/loader.test.js Outdated Show resolved Hide resolved
__tests__/loader.test.js Outdated Show resolved Hide resolved
__tests__/loader.test.js Outdated Show resolved Hide resolved
src/extractor.js Show resolved Hide resolved
src/index.js Outdated Show resolved Hide resolved
src/loader.js Outdated Show resolved Hide resolved
garrett-wade and others added 6 commits March 2, 2022 08:04
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
Co-authored-by: Jon Ursenbach <erunion@users.noreply.github.com>
@garrett-wade
Copy link
Contributor Author

@erunion thanks for all of the feedback! This is my first time contributing to an open source library as well as extending a node.js library in general. Thank you for taking the time to make the suggestions, learned a lot!

Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

Thanks again for this!

@erunion erunion merged commit 2caec29 into readmeio:main Mar 2, 2022
@erunion
Copy link
Member

erunion commented Mar 2, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants