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

Broaden character support for quoted rule names #48

Closed
wilrodriguez opened this issue Jan 15, 2023 · 2 comments
Closed

Broaden character support for quoted rule names #48

wilrodriguez opened this issue Jan 15, 2023 · 2 comments

Comments

@wilrodriguez
Copy link

As mentioned in #44 where it was discovered that rule keys didn't support dashes, it has become apparent that rule keys don't currently support the full character set of available string values that can be used in YAML. Notably, they do not currently support spaces, which are fairly commonly used in string keys in YAML due to its natural language-like syntax. In order to add this support, we'll need to change the syntax to allow for quoted strings to be passed as rule keys, which will likely create both a plain bareword string syntax, as well as a quoted string syntax. As it stands, I would expect that we could leave the existing regex in place to match bareword strings, though, quoted strings should probably provide support for spaces. This could probably take advantage of the built-in common.ESCAPED_STRING rule (though I personally couldn't figure out how to get it to work).

I'd think that bareword strings should probably be based on the previous regex as well, something like /[a-zA-z0-9_-]+/. Though, I'd say that's probably not as big of a deal

@wilrodriguez wilrodriguez changed the title Broaden rule key character support Broaden rule key character support for quoted rule names Jan 15, 2023
@wilrodriguez wilrodriguez changed the title Broaden rule key character support for quoted rule names Broaden character support for quoted rule names Jan 15, 2023
@ryan95f
Copy link
Owner

ryan95f commented Jan 16, 2023

As part of PR #45 I have implemented an update to the rule names to support all unicode characters and key names with spaces. This has been released in 0.2.1. As suggested, key names with spaces need to be enclosed with double quotes. For example, given the following schema:

schema {
    "my awesome key" str
}

Should be able to evaluate:

my awesome key: hello world

If this isn't working on your end. Can you please share your schema file?

@wilrodriguez
Copy link
Author

...Nevermind. Ignore me. I misread the changes in #45 Thanks again as always Ryan.

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

No branches or pull requests

2 participants