spullara / spullara/mustache.java

Mustache engine handles possibly invalid keynames in possibly incorrect way

Open
#297 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
2k
Forks
281
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/mustache/spec/issues/179 for an issue raised on the mustache spec repository.

In brief, mustache.java renders the input data

{ "a.b": "c" }

and template

{{ a.b }}

as

c

which is in a perhaps-incorrect way, although one that is not actually specified by the spec. It is likely that keys are never intended to have periods in them (see https://github.com/mustache/spec/issues/67#issuecomment-53523219), but again, this is not actually specified.

Note that other engines, such as both of the python ones I have checked, render this as a blank.

Note further that the current java engine prioritises a key with a period over nested data: that is, the following data renders probably incorrectly (though again, not actually counter to the specification):

{ "a": { "b": "expected"}, "a.b": "c" }

and

{{ a.b }}

render as

c

which is not what I would expect.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No implementation files or tests are named. Start by reading the linked Mustache specification issue 179, then trace mustache.java's key-resolution behavior for the two examples in this issue. Done means an agreed, specification-backed result for dotted keys and a regression test covering the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.