Skip to content

Mustache engine handles possibly invalid keynames in possibly incorrect way #297

Open
@simon-ess

Description

@simon-ess

See mustache/spec#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 mustache/spec#67 (comment)), 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions