-
Notifications
You must be signed in to change notification settings - Fork 349
Open
Labels
spec-deviationBugs where the implementation does not follow the spec.Bugs where the implementation does not follow the spec.
Description
A hash just by itself is not a valid identifier per the spec:
https://cuelang.org/docs/reference/spec/#identifiers
identifier = [ "#" | "_#" ] letter { letter | unicode_digit } .
However, as of 2d28bd3, they clearly work in the current implementation:
exec cue export input.cue
-- input.cue --
#: "foo"
bar: #
> exec cue export input.cue
[stdout]
{
"bar": "foo"
}
Moreover, they get used by the jsonschema encoding as well:
exec cue def input.json
-- input.json --
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"some-thing": {
"type": "string"
}
}
}
> exec cue def input.json
[stdout]
@jsonschema(schema="https://json-schema.org/draft/2020-12/schema")
_
#: {
"some-thing": string
}
It may be too late or painful to remove support for hash identifiers at this point, if we never intended them to work. The easier alternative seems to be to adjust the spec to reflect reality. cc @rogpeppe
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
spec-deviationBugs where the implementation does not follow the spec.Bugs where the implementation does not follow the spec.