Change field separator to double-underscore, defined as a constant#688
Change field separator to double-underscore, defined as a constant#688ghost wants to merge 1 commit intorjsf-team:masterfrom
Conversation
|
Dunno what version of prettier you did use but could you please rebase against latest master and ensure 1.6.1 is installed and used to format your code? That would greatly help reviewing this diff. |
fb05b5a to
c46cbc0
Compare
|
@n1k0 thanks for the guidance. Prettier 1.6.1 was already in use. Rebasing seems to have done the trick. Only the relevant diffs now show (except for a couple of Prettier reformats, due to line length increase). |
|
It seems like we don't describe |
|
Could we parameterize the separator and keep single underscore as default? That way we could keep backward compability. Also, there could be users with fields that have two underscores in field names (not likely, but possible). I rely heavily on the current |
|
Hi Guys, Any update on this? |
|
I think, as @olzraiti said, it would make sense to keep it using one underscore as the delimiter, but keep the option to change the delimiter as an option; perhaps it could be passed in as a prop. If you can make a PR based off of this one that does this, I'd be ready to merge it! |
Reasons for making this change
idSchema.$idcurrently uses_to separate fields. Some apps need to parse id (e.g. to navigate a redux global state tree).Problem: Having a single underscore as field separator prevents form field names from containing underscore -- non-field-separating underscores are confused with actual field separators.
While JS style is camelCase, may be too rigid a constraint. E.g. for our current project, we are attempting to port a python app which liberally uses underscores, and forcing field name changes to exclude underscore is too imposing.
Proposed solution
Replace single underscore with double underscore. Although a double-underscore is still somewhat arbitrary, it should accommodate the majority of cases.
Changes made
This is an internal change. Thus, the primary goal was to ensure all existing tests pass.
Besides the double-underscore change, the only other diffs were formatting changes introduced by Prettier (
npm run cs-format). Seems strange that it would cause so many formatting diffs?Checklist
npm run cs-formaton my branch to conform my code to prettier coding style