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

Change the name of registerDocumentFormats #488

Closed
chris48s opened this issue Aug 6, 2024 · 3 comments · Fixed by #487
Closed

Change the name of registerDocumentFormats #488

chris48s opened this issue Aug 6, 2024 · 3 comments · Fixed by #487

Comments

@chris48s
Copy link
Owner

chris48s commented Aug 6, 2024

Today in "naming things is hard"..

The term "format" is too overloaded, particularly given you refer to the output formats as just --format.

Maybe change this to either registerDocumentParsers or registerDocumentFormatParsers

Compare

/**
 * Use the `registerDocumentFormats` hook to tell v8r about additional
 * document formats that can be parsed. Any formats registered with this hook
 * become valid values for the `parser` property in custom schemas.
 *
 * @returns {string[]}
 */
registerDocumentFormats() {
  return [];
}

to

/**
 * Use the `registerDocumentParsers` hook to tell v8r about additional
 * document formats that can be parsed. Any parsers registered with this hook
 * become valid values for the `parser` property in custom schemas.
 *
 * @returns {string[]}
 */
registerDocumentParsers() {
  return [];
}

I feel like the second is clearer.

@chris48s chris48s added this to the Launch Plugins Feature milestone Aug 6, 2024
@chris48s
Copy link
Owner Author

chris48s commented Aug 6, 2024

I reckon also change the name of the 3rd argument to parseDocument() from format to parser and update the docs accordingly

@chris48s
Copy link
Owner Author

chris48s commented Aug 7, 2024

Hmm, but does parser imply it is the parser function itself. At least with format it is more clear this is a string like "toml" or "json".

You could always consider a breaking change to the config file/command line args to clean up the terminology there a bit.

Decisions decisions.

@chris48s
Copy link
Owner Author

chris48s commented Aug 19, 2024

I ended up going with

  • registerInputFileParsers()
  • parseInputFile(contents, fileLocation, parser)

see
#487 (comment)

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

Successfully merging a pull request may close this issue.

1 participant