-
Notifications
You must be signed in to change notification settings - Fork 14
Add statement about possibility of source map rejecting in case of an invalid version field #25
Conversation
… invalid version field
My opinion here is that we should enforce rejection as if it was, for example, an encoding error. There is a risk that one day in the future there will be a new source map version, and we should avoid source map v3 tools to accidentally consume a source map v(future) and provide wrong-but-not-rejected results. |
Also should we be specific about backward compatibility as well? E.g Implementations with support for v4 should still accept versions v3. |
How about "must"? |
I don't think we're going to do any more version number increments. |
I would recommend to treat it as an error in the file, but I would not go as far as mandating a particular rejection, at least not for all consumers of a source map. It should however not be considered a valid source map. (Which goes a little bit into what a tool should be doing for invalid source maps and quite frankly my recommendation would be to still try to apply it, even if there are issues with it.) |
It sounds like a topic to discuss on one of the upcoming meeting. |
source-map.bs
Outdated
@@ -168,7 +168,7 @@ for practical reasons, the order cannot be defined in many JSON generators and | |||
has never been enforced. | |||
|
|||
<dfn><code>version</code></dfn> is the version field which is always the number | |||
`3` as an integer. | |||
`3` as an integer. Source map can be rejected in case of a value different from `3`. |
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.
...which must always be the number 3
as an integer. The source map may be rejected in case of a value different from 3
.
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.
Done ✅
Going to merge this. If, in the future, we realize there are multiple invalid fields that consumers try to recover, we should consider making a top level note that consumers may try to recover invalid source maps. |
SHA: 695bcf5 Reason: push, by jkup Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I'm not quite sure about
can be rejected
instead ofshould be rejected,
but I feel there should be freedom for choosing such behavior for tooling, but it is discussable.Want to hear your opinions @mitsuhiko @littledan @jkup