Skip to content
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

Top-level List as data is not supported #44

Open
mrueg opened this issue Nov 16, 2023 · 2 comments
Open

Top-level List as data is not supported #44

mrueg opened this issue Nov 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mrueg
Copy link
Contributor

mrueg commented Nov 16, 2023

Description

A clear and concise description of the bug.

How to Reproduce

  1. Go to cel-playground
  2. Enter a valid JSON with a top-level array [ { "noun": "lion", "population": 123, "predator": true }, { "noun": "deer", "population": 456, "predator": false }, { "noun": "pigeon", "population": 789, "predator": false } ]
  3. Press Run
  4. View Output
  line 1: cannot unmarshal !!seq into map[string]interface {}

Expected Behavior

Top-level Array should be accepted as it's valid JSON. See: https://stackoverflow.com/questions/3833299/can-an-array-be-top-level-json-text

Screenshots

If applicable, add screenshots to help explain your problem.

System Information

  • OS: [e.g. MacOS]
  • OS Version: [e.g. 12.0]
  • Language Version: [e.g. Go 1.17.5, Node 16.13.1]
  • Package Manager Version: [e.g. NPM 6.14.1]
  • Browser (if applicable): [e.g. Google Chrome]
  • Browser Version (if applicable): [e.g. 81.0.4044.138]

Additional Context

Here's an example: https://playcel.undistro.io/?content=H4sIAAAAAAAAA4WQSQrDMAxFryK09qZz66tUWRiilICxjAcohNy9ciB006Qb8XkfPYQm7F1xaPFJAWBqA4AwSA2EVpMfRZNZiyixelcWaOFwPH2bxKqS1HhJlRufzYa1Z06b1vPl%2BtM6OJ%2F3tXF88c65t%2Fvjj5hChwb5rW3OuqWPIRxECHH%2BAMP1TOcrAQAA

@mrueg mrueg added the bug Something isn't working label Nov 16, 2023
@matheusfm
Copy link
Contributor

Hi @mrueg!
Thank you for opening this issue!
Yeah, it's really valid JSON. But I don't know how it could be accessible in CEL expression without a variable name.
Do you have any idea?

Putting the array into any variable, like the example below, should work..
Does it make sense for your case?

https://playcel.undistro.io/?content=H4sIAAAAAAAAA42QTQoCMQxGrxKy7sZ%2F7VWMi%2BpEGSlt6bQglN7daBnQhc5kkw9eyCMp2JlkUGMhR%2BjPd74kQk0OpI6tAZQxABA6n2VUS7K9l6Q%2BYfAhW5PeQMNiufqmkUXn44ulmHlkVU2YOub417TebH%2BarsYO81Whv%2FHEWbv9YaashRO5igr5IYPDIEvk3%2B3VWJ9rxsH7gQEAAA%3D%3D

@mrueg
Copy link
Contributor Author

mrueg commented Nov 24, 2023

Thanks for your response @matheusfm !
It's clearly an option, but might make things more difficult when applying custom CEL code afterwards (as I'd have to retrofit it) I've started a discussion in the cel-go repo as well.

@knrc knrc mentioned this issue Aug 12, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants