Title: Support `CelOptions` to disable string conversion and list/string concatenation · Issue #502 · cel-expr/cel-java · GitHub
Open Graph Title: Support `CelOptions` to disable string conversion and list/string concatenation · Issue #502 · cel-expr/cel-java
X Title: Support `CelOptions` to disable string conversion and list/string concatenation · Issue #502 · cel-expr/cel-java
Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. Change To make CEL environment setup cons...
Open Graph Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. C...
X Description: Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Repor...
Opengraph URL: https://github.com/cel-expr/cel-java/issues/502
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support `CelOptions` to disable string conversion and list/string concatenation","articleBody":"**Feature request checklist**\n\n- [x] There are no issues that match the desired change\n- [ ] The change is large enough it can't be addressed with a simple Pull Request\n- [x] If this is a bug, please file a [Bug Report](./ISSUE_TEMPLATE).\n\n**Change**\nTo make CEL environment setup consistent across CEL implementations, I propose to add equivalent runtime options that control string conversion and list/string concatenation equivalent to those found in CEL-cpp:\n\n```cpp\n// Enable string() overloads.\nbool enable_string_conversion = true;\n\n// Enable string concatenation overload.\nbool enable_string_concat = true;\n\n// Enable list concatenation overload.\nbool enable_list_concat = true;\n```\n\n**Example**\n```java\nCelCompiler CEL_COMPILER = CelCompilerFactory.standardCelCompilerBuilder()\n .setResultType(SimpleType.BOOL)\n .build();\n\n@Test\npublic void cel_stringConversionDisabled() throws Exception {\n CelRuntime CEL_RUNTIME = CelRuntimeFactory.standardCelRuntimeBuilder()\n .setOptions(CelOptions.current().enableStringConversion(false).build())\n .build();\n\n // TODO: verify conversions to all types.\n String expr = \"string(3.14) == '3.14'\";\n CelRuntime.Program program = CEL_RUNTIME.createProgram(CEL_COMPILER.compile(expr).getAst());\n CelEvaluationException celErr = assertThrows(CelEvaluationException.class, program::eval);\n assertThat(celErr.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);\n}\n\n@Test\npublic void cel_stringConcatDisabled() throws Exception {\n CelRuntime CEL_RUNTIME = CelRuntimeFactory.standardCelRuntimeBuilder()\n .setOptions(CelOptions.current().enableStringConcat(false).build())\n .build();\n\n String expr = \"'ab' + 'cd' == 'abcd'\";\n CelRuntime.Program program = CEL_RUNTIME.createProgram(CEL_COMPILER.compile(expr).getAst());\n CelEvaluationException celErr = assertThrows(CelEvaluationException.class, program::eval);\n assertThat(celErr.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);\n}\n\n@Test\npublic void cel_listConcatDisabled() throws Exception {\n CelRuntime CEL_RUNTIME = CelRuntimeFactory.standardCelRuntimeBuilder()\n .setOptions(CelOptions.current().enableListConcat(false).build())\n .build();\n\n String expr = \"size([1, 2] + [3, 4]) == 4\";\n CelRuntime.Program program = CEL_RUNTIME.createProgram(CEL_COMPILER.compile(expr).getAst());\n CelEvaluationException celErr = assertThrows(CelEvaluationException.class, program::eval);\n assertThat(celErr.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);\n}\n```\n\n**Related**\n* Corresponding cel-go request: google/cel-go#1078\n* Internal ref: go/grpc-cel-integration\n","author":{"url":"https://github.com/sergiitk","@type":"Person","name":"sergiitk"},"datePublished":"2024-11-25T18:09:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/502/cel-java/issues/502"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6999b1c8-ec1e-2335-340b-ae6df7d86a2c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8B98:232221:B6B587:BAB446:6A4DB78B |
| html-safe-nonce | fee6fd0d780261857a0131dfdd77622e51c4b345949a0a588aae82e64fbdeb36 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Qjk4OjIzMjIyMTpCNkI1ODc6QkFCNDQ2OjZBNERCNzhCIiwidmlzaXRvcl9pZCI6IjUyMzcyNzUyNzU2MjA2MjgzNjMiLCJyZWdpb25fZWRnZSI6InNlYSIsInJlZ2lvbl9yZW5kZXIiOiJzZWEifQ== |
| visitor-hmac | 506057573d3c8ad563b7bc76602baf92fe687cac4310e3eb855846a15a5f85e0 |
| hovercard-subject-tag | issue:2691743466 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cel-expr/cel-java/502/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b348459770d493d958184111698445b48b139646b92dfa1b24321b41d42e9741/cel-expr/cel-java/issues/502 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b348459770d493d958184111698445b48b139646b92dfa1b24321b41d42e9741/cel-expr/cel-java/issues/502 |
| og:image:alt | Feature request checklist There are no issues that match the desired change The change is large enough it can't be addressed with a simple Pull Request If this is a bug, please file a Bug Report. C... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sergiitk |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/cel-expr/cel-java git https://github.com/cel-expr/cel-java.git |
| octolytics-dimension-user_id | 186625994 |
| octolytics-dimension-user_login | cel-expr |
| octolytics-dimension-repository_id | 587078119 |
| octolytics-dimension-repository_nwo | cel-expr/cel-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 587078119 |
| octolytics-dimension-repository_network_root_nwo | cel-expr/cel-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 32f7b614aca06e6bbd89842b1370df1328264f68 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width