-
Notifications
You must be signed in to change notification settings - Fork 63
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
Capitalize RFC 2119 keywords when appropriate #94
Conversation
✔️ Deploy Preview for dtcg-tr ready! 🔨 Explore the source changes: 29ba4a3 🔍 Inspect the deploy log: https://app.netlify.com/sites/dtcg-tr/deploys/61eefc6aab616600073c8f4e 😎 Browse the preview: https://deploy-preview-94--dtcg-tr.netlify.app |
21fff16
to
6048988
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. I've queried some of the changes, but not 100% sure about them TBH. It's quite subjective as to what is or isn't something that affects interoperability.
@@ -7,7 +7,7 @@ Aliases are useful for: | |||
- Expressing design choices | |||
- Eliminating repetition of values in token files (DRYing up the code) | |||
|
|||
For a design token to reference another, its value should be a string containing the period-separated (.) path to the token it's referencing enclosed in curly brackets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps this needs to be MUST rather than SHOULD. Parsers should reject reference that don't conform to the syntax we're defining here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Change to "MUST".
technical-reports/format/aliases.md
Outdated
|
||
Aliases may reference other aliases. In this case, tools should follow each reference until they find a token with an explicit value. Circular references are not allowed. If a design token file contains circular references, then the value of all tokens in that chain is unknown and an appropriate error or warning message should be displayed to the user. | ||
Aliases MAY reference other aliases. In this case, tools SHOULD follow each reference until they find a token with an explicit value. Circular references are not allowed. If a design token file contains circular references, then the value of all tokens in that chain is unknown and an appropriate error or warning message SHOULD be displayed to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this needs to be stricter too: "In this case, tools MUST follow each reference..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, first SHOULD on line 35 should change to MUST.
@@ -62,7 +62,7 @@ Due to the syntax used for [token aliases](#aliases-references) the following ch | |||
|
|||
### Token value type | |||
|
|||
Token values may be any valid JSON type: | |||
Token values MUST be a valid JSON type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... re-reading this now, I'm think we don't need this "Token value type" section at all.
The "Type" chapter later on explains things more clearly. As it says there, every token has an unambiguous type (which inlude the basic JSON types like string, number, etc.) and there is an algorithm for determining it.
This section doesn't add anything useful and, if anything, might confuse people.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and the statement "Token values MUST be a valid JSON type" is inaccurate since we're defining a number of additional types beyond the standard JSON set.
|
||
<div class="issue" data-number="55" title="Object vs Array"> | ||
|
||
The structure in the example above is a JSON object, an **unordered** set of name/value pairs. | ||
|
||
- Objects can't contain members with duplicate keys | ||
- Ordering of object members may not be preserved (as per [RFC 7159](https://tools.ietf.org/html/rfc7159#section-4)), meaning token retrieval may or may not result in the same ordering as the input | ||
- Ordering of object members MAY NOT be preserved (as per [RFC 7159](https://tools.ietf.org/html/rfc7159#section-4)), meaning token retrieval MAY or MAY NOT result in the same ordering as the input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these need to be capitalised "MAY"s. This line is just highlighting something we inherit from the underlying JSON spec. We're not actually specifying something that implementors MAY do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a rewrite:
Ordering of object members is not guaranteed (as per RFC 7159)
|
||
## Description | ||
|
||
A plain text description explaining the token's purpose. Tools MAY use the description in various ways. | ||
|
||
For example: | ||
|
||
- Style guide generators could display the description text alongside a visual preview of the token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are just examples to illustrate how description
may be used or persented in different kinds of tools.
RFC 2119 states:
Imperatives of the type defined in this memo must be used with care
and sparingly. In particular, they MUST only be used where it is
actually required for interoperation or to limit behavior which has
potential for causing harm (e.g., limiting retransmisssions) For
example, they must not be used to try to impose a particular method
on implementors where the method is not required for
interoperability.
I don't think these examples affect interoperability, so I think they shouldn't use capitalised imperatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This feels like an overreach of a find/replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, looking at this more closely, I think the MAY's make sense here. Yes, they are examples, but they're describing potential tool functionality and using MAY helps with interoperability since it's not required functionality. I may be reading this wrong though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I'm inclined to agree with your @kevinmpowell
FWIW, reviewing this PR has made me realise applying RFC 2119 appropriately is a lot harder than it looks!
@@ -11,7 +11,7 @@ Few examples: | |||
- `color-text-primary: #000000;` | |||
- `font-size-heading-level-1: 44px;` | |||
|
|||
The name may be associated with additional [Token Properties](#design-token-properties). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need uppercase MAY here as this is the terminology section, which is just descriptive. We're not specifying anything that implementors or authors need to do here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
technical-reports/format/types.md
Outdated
@@ -58,7 +58,7 @@ $translucent-shadow: hsla(300, 100%, 50%, 0.5); | |||
|
|||
## Dimension | |||
|
|||
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `type` property must be set to the string "dimension". The value must be a string containing a number (either integer or floating-point) followed by either a "px" or "rem" unit (future spec iterations may add support for additional units). | |||
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `type` property must be set to the string "dimension". The value must be a string containing a number (either integer or floating-point) followed by either a "px" or "rem" unit (future spec iterations MAY add support for additional units). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this one needs to be uppercase, as this is just an FYI. We're not specifying anything for implementors or authors in order for them to conform to this spec version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
technical-reports/format/types.md
Outdated
|
||
## Font name | ||
|
||
<div class="issue" data-number="53"> | ||
|
||
A naive approach like the one below may be appropriate for the first stage of the specification, but this may be more complicated than it seems due to platform/OS/browser restrictions. | ||
A naive approach like the one below MAY be appropriate for the first stage of the specification, but this could be more complicated than it seems due to platform/OS/browser restrictions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably don't need uppercase MAY here either, since is just an issue description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @c1rrus' feedback here. This is largely solid, but there's a few cases where "may" is used descriptively.
@@ -7,7 +7,7 @@ Aliases are useful for: | |||
- Expressing design choices | |||
- Eliminating repetition of values in token files (DRYing up the code) | |||
|
|||
For a design token to reference another, its value should be a string containing the period-separated (.) path to the token it's referencing enclosed in curly brackets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Change to "MUST".
technical-reports/format/aliases.md
Outdated
|
||
Aliases may reference other aliases. In this case, tools should follow each reference until they find a token with an explicit value. Circular references are not allowed. If a design token file contains circular references, then the value of all tokens in that chain is unknown and an appropriate error or warning message should be displayed to the user. | ||
Aliases MAY reference other aliases. In this case, tools SHOULD follow each reference until they find a token with an explicit value. Circular references are not allowed. If a design token file contains circular references, then the value of all tokens in that chain is unknown and an appropriate error or warning message SHOULD be displayed to the user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, first SHOULD on line 35 should change to MUST.
@@ -62,7 +62,7 @@ Due to the syntax used for [token aliases](#aliases-references) the following ch | |||
|
|||
### Token value type | |||
|
|||
Token values may be any valid JSON type: | |||
Token values MUST be a valid JSON type: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, and the statement "Token values MUST be a valid JSON type" is inaccurate since we're defining a number of additional types beyond the standard JSON set.
|
||
<div class="issue" data-number="55" title="Object vs Array"> | ||
|
||
The structure in the example above is a JSON object, an **unordered** set of name/value pairs. | ||
|
||
- Objects can't contain members with duplicate keys | ||
- Ordering of object members may not be preserved (as per [RFC 7159](https://tools.ietf.org/html/rfc7159#section-4)), meaning token retrieval may or may not result in the same ordering as the input | ||
- Ordering of object members MAY NOT be preserved (as per [RFC 7159](https://tools.ietf.org/html/rfc7159#section-4)), meaning token retrieval MAY or MAY NOT result in the same ordering as the input |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a rewrite:
Ordering of object members is not guaranteed (as per RFC 7159)
|
||
## Description | ||
|
||
A plain text description explaining the token's purpose. Tools MAY use the description in various ways. | ||
|
||
For example: | ||
|
||
- Style guide generators could display the description text alongside a visual preview of the token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. This feels like an overreach of a find/replace.
@@ -11,7 +11,7 @@ Few examples: | |||
- `color-text-primary: #000000;` | |||
- `font-size-heading-level-1: 44px;` | |||
|
|||
The name may be associated with additional [Token Properties](#design-token-properties). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
technical-reports/format/types.md
Outdated
@@ -58,7 +58,7 @@ $translucent-shadow: hsla(300, 100%, 50%, 0.5); | |||
|
|||
## Dimension | |||
|
|||
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `type` property must be set to the string "dimension". The value must be a string containing a number (either integer or floating-point) followed by either a "px" or "rem" unit (future spec iterations may add support for additional units). | |||
Represents an amount of distance in a single dimension in the UI, such as a position, width, height, radius, or thickness. The `type` property must be set to the string "dimension". The value must be a string containing a number (either integer or floating-point) followed by either a "px" or "rem" unit (future spec iterations MAY add support for additional units). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
technical-reports/format/types.md
Outdated
|
||
## Font name | ||
|
||
<div class="issue" data-number="53"> | ||
|
||
A naive approach like the one below may be appropriate for the first stage of the specification, but this may be more complicated than it seems due to platform/OS/browser restrictions. | ||
A naive approach like the one below MAY be appropriate for the first stage of the specification, but this could be more complicated than it seems due to platform/OS/browser restrictions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree.
Fixes #77
This PR also introduces a few edits, to try and use less ambiguous keywords when possible, or to make it clear that one of the sections isn't normative.