Skip to content

Pattern support#249

Merged
erunion merged 18 commits intoreadmeio:mainfrom
garrett-wade:patternSupport
Mar 2, 2022
Merged

Pattern support#249
erunion merged 18 commits intoreadmeio:mainfrom
garrett-wade:patternSupport

Conversation

@garrett-wade
Copy link
Copy Markdown
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
Copy Markdown
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}"

Comment thread src/cli.js Outdated
Comment thread __tests__/extractor.test.js Outdated
Comment thread __tests__/extractor.test.js Outdated
Comment thread src/extractor.js Outdated
Comment thread src/extractor.js Outdated
Comment thread src/index.js Outdated
Comment thread src/loader.js Outdated
@garrett-wade
Copy link
Copy Markdown
Contributor Author

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

@erunion
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@erunion was able to run

Comment thread __tests__/loader.test.js Outdated
Comment thread package.json
Copy link
Copy Markdown
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.

Comment thread __tests__/loader.test.js Outdated
Comment thread __tests__/loader.test.js Outdated
Comment thread __tests__/loader.test.js Outdated
Comment thread __tests__/loader.test.js Outdated
Comment thread src/extractor.js
Comment thread src/index.js Outdated
Comment thread src/loader.js Outdated
garrett-wade and others added 6 commits March 2, 2022 08:04
Co-authored-by: Jon Ursenbach <[email protected]>
Co-authored-by: Jon Ursenbach <[email protected]>
@garrett-wade
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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