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

"single line" format ? #637

Closed
kapouer opened this issue Jul 16, 2018 · 2 comments
Closed

"single line" format ? #637

kapouer opened this issue Jul 16, 2018 · 2 comments

Comments

@kapouer
Copy link

kapouer commented Jul 16, 2018

This is very naive proposal but it makes sense for me, so why not for the spec...
format: singleline
pattern: /^[^\n\r]*$/

The idea is to be able to tell when a string is supposed to not be a multiline string.

@gregsdennis
Copy link
Member

gregsdennis commented Jul 16, 2018

I see you have a regex there to qualify when a string is a single line. It's pretty simple, too.

Typically, formats have been for things that either can't be perfectly qualified by regex or are really complicated, like URIs.

Also, I wonder if the utility of this warrants a new format. Seems like maybe it would be better to include it in a listing of "common" expressions that can be used with the pattern keyword.

@handrews
Copy link
Contributor

This should just be done with pattern, and if you want to name it, you can make a definition under definitions (current) or $defs (future). format is for things that have semantic meaning that isn't apparent from a regex (how many of us would recognize an email address regex if we saw one? they're absurdly complex if they're even useful at all).

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

No branches or pull requests

3 participants