Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

String token directives should require quoted values. #980

Closed
pranavkm opened this issue Feb 8, 2017 · 6 comments
Closed

String token directives should require quoted values. #980

pranavkm opened this issue Feb 8, 2017 · 6 comments
Assignees

Comments

@pranavkm
Copy link
Contributor

pranavkm commented Feb 8, 2017

Quotes are optional for some string-like tokens in directives (for instance in @addTagHelper). However the optionality is enforced at code gen rather than at parse time. We could instead remove quotes from string tokens at parse time.

@rynowak
Copy link
Member

rynowak commented Feb 9, 2017

We should absolutely not do this. The taghelper directives are special and it is a non goal that they reuse the extensible directives feature.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 9, 2017

Would we expect to support @page "some-route"? Right now, we end up treating quotes as part of the token. Seems reasonable to generalize this to all "string" like values in descriptors.

@rynowak
Copy link
Member

rynowak commented Feb 9, 2017

We should only support @page "some-route" and the token api we provide should give you access to the both the 'quoted' span/text and the 'unquoted' span/text.


I'll repeat, you can do things with the taghelper directives like:

@addTagHelper Foo, Bar
@addTagHelper "Baz, Bar" 

In both of these cases, everything after @addTagHelper is a single token (Foo, Bar and "Baz, Bar").

This only works because we know what the syntax of Foo, Bar is supposed to be. We fully parse it, and then throw away the information so we can do it again later.

This kind of thing is a trap and should be avoided. We shipped this in 1.0.0 and it has to stay working, but it shouldn't infect the extensible directives feature.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 9, 2017

Cool I'm all for normalizing it (one way or the other).

@pranavkm pranavkm changed the title Normalize on optional quotes for string tokens in directives String token directives should require quoted values. Feb 9, 2017
@rynowak
Copy link
Member

rynowak commented Feb 9, 2017

Cool I'm all for normalizing it (one way or the other).

No. It has to be with quotes.

@pranavkm
Copy link
Contributor Author

pranavkm commented Feb 9, 2017

^ See title.

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

No branches or pull requests

3 participants