-
Notifications
You must be signed in to change notification settings - Fork 72
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
Clarify that the context root can be iterated over #176
Clarify that the context root can be iterated over #176
Conversation
This looks like it is adding the JSON for #199 and what looks like some out-of-sync JSON and YAML from mustache#149.
Since some implementations differ on whether the root of the context stack can be iterated over, this adds langauge to the "Sections" spec clarifying that it can. It also adds a test for this case. Fixes mustache#87. I did not add the two additional tests for the "Interpolation" spec that I recommended in that issue, since there are tests that cover them now (not sure if these are new or if I just missed them before).
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.
☑️ The changes look reasonable to me.
☑️ Wontache passes the new spec without modification.
☑️ I can confirm that the updated JSON is exactly the output of rake build
.
Open questions:
- Is this just fixing an omission (I say yes) or do some consider this "too breaking"?
- You said the interpolation tests you suggested in Clarification on root-level implicit iterators #87 (comment) were already included. I found the second one but not the first, copied below. To me, it looks reasonable to add as well, though I think it belongs in the
sections.yml
.
- name: Dotted Names - Single Period
desc: A single period should resolve to the top of the context stack.
data:
name: 'Alice'
template: '{{#name}}({{.}}){{/name}}'
expected: '(Alice)'
Yes please! |
From a semantic versioning and spec-based perspective, I think this is a minor release/new feature (so: v1.4.0). It is adding definition where behavior is currently undefined. That said, I can definitely see the argument that, from an implementor perspective, this is breaking and requires a major release, since code that passes tests and matches the specs today could become incorrect as soon as this lands (e.g. Hogan would become non-compliant). But the same could be said for a lot of (most?) new features in the spec. I think the more salient thing is whether this changes existing defined behavior, and it does not do that.
Ah! I should have linked them in the PR description, sorry. They are:
|
This didn't sit well with me, but fortunately, the README is quite clear about what should happen:
As you wrote, the change is not backwards incompatible, so no major version.
I would argue that there is no new language feature in play here. You are just making a clarification about a language feature that was previously introduced. Hence, I don't think this is a minor version, either.
My interpretation of "bug" here is
My interpretation of your change is that it is an instance of number 3, so I think this change by itself would constitute a patch version. |
@spullara or @bobthecow, do you agree we can merge this? |
Looks good to me. I am pretty sure this is already my current behavior. |
Thanks and congratulations @Mr0grog! |
👍 to merging it, but 👎 for making it a patch release. it's specifying previously unspecified behavior, so it's at least a minor version. "bug" is "we meant a thing, but tested for it poorly". i'd interpret the backwards compatibility requirement not as "won't make existing implementations non-compliant" but as "changing a thing previously required", i.e. it wouldn't be possible to pass both the previous version and this version of the spec. so this feels like a minor version change to me. |
Do you think this is previously unspecified behavior? I think this was intended all along, but tested incompletely. In #87, everyone seemed to have interpreted the spec in this way already. Just a few comments up, @Mr0grog also pointed out that similar behavior was already specified for the interpolation tag, which makes it seem reasonable that the section tag should behave analogously: Lines 202 to 208 in 982aa9b
Sound like we all agree on how to decide whether something is a major release. Perhaps you missed my previous comment: #176 (comment). |
if that's the case, and if everyone implemented it this way, then i'm fine with "patch".
I didn't miss it, I was confirming that I don't think it requires a major version, as an aside, while talking about whether it was minor or patch 😛 |
Since some implementations differ on whether the root of the context stack can be iterated over, this adds langauge to the "Sections" spec clarifying that it can. It also adds a test for this case.
Fixes #87. I did not add the two additional tests for the "Interpolation" spec that I recommended in that issue since there are tests that cover them now (not sure if these are new or if I just missed them before).
The first commit here is just the result of running
rake build
before making the above changes, since the current JSON and YAML are out of sync. I can separate that into a different PR if helpful, or you can just review this by focusing on the second commit. (As a side note: would it be helpful to have a GitHub action to check PRs for whether the JSON and YAML are in sync? I’m happy to do a PR that adds that.)