Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Ability to provide type hints to non-identifier keys #871

Copy link
Copy link

Description

@stopachka
Issue body actions

Consider a JSON object

{ 
   "with-hyphen": "a-string", 
   "$startsWithDollarSign": 123
}

Problem: It's not possible to provide type-hints for with-hyphen and $startsWithDolalrSign

CEL can get type information well if we can express an object as protobuf, or use StructType. However, there are times when we have objects that have non-identifier keys.

Right now, it's not possible to provide typesafety for non-identifier keys.

It would be amazing if we could.

Alternatives considered

To solve this for ourselves, we considered to hacks:

  1. Use aliases: walk the CEL tree, and rename all non-identifer keys to some known identifer-style key.
  2. Run our own compile step validation: walk the cel tree, and do the type checking ourselves.

Right now we are going with 2., but if there was some built-in way to specify types for keys from index access, it would be amazing.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.