-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[server-route-repository] Only validate zod schemas in dev mode #210412
[server-route-repository] Only validate zod schemas in dev mode #210412
Conversation
Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant) |
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment to improve the name of this field. :)
src/platform/packages/shared/kbn-server-route-repository/src/register_routes.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Starting backport for target branches: 8.18, 8.x, 9.0 |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
History
|
elastic#210412) In elastic#208166, we added a validation step that verifies that all zod schemas: a) Are built with supported types, meaning types that we can analyze for if they are applied strictly (no excess keys) b) Are built with any side effects (refine or transform, which may impact the type reliability) This doesn't impact the actual parameter validation, but is instead an additional check on the schemas we're using. For any violation found, we log a warning, this has the downside of increasing our total log volume and is only really needed in development mode. Hence, in this PR, we're only logging these warnings if Kibana is running in dev mode, and the PR updates all consuming plugins to pass this context along. (cherry picked from commit 42f5b0b)
elastic#210412) In elastic#208166, we added a validation step that verifies that all zod schemas: a) Are built with supported types, meaning types that we can analyze for if they are applied strictly (no excess keys) b) Are built with any side effects (refine or transform, which may impact the type reliability) This doesn't impact the actual parameter validation, but is instead an additional check on the schemas we're using. For any violation found, we log a warning, this has the downside of increasing our total log volume and is only really needed in development mode. Hence, in this PR, we're only logging these warnings if Kibana is running in dev mode, and the PR updates all consuming plugins to pass this context along. (cherry picked from commit 42f5b0b)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run:
Questions ?Please refer to the Backport tool documentation |
…ev mode (#210412) (#210795) # Backport This will backport the following commits from `main` to `9.0`: - [[server-route-repository] Only validate zod schema effects in dev mode (#210412)](#210412) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-12T11:28:10Z","message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Obs AI Assistant","Team:obs-ux-management","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[server-route-repository] Only validate zod schemas in dev mode","number":210412,"url":"https://github.com/elastic/kibana/pull/210412","mergeCommit":{"message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210412","number":210412,"mergeCommit":{"message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Milton Hultgren <[email protected]>
…dev mode (#210412) (#210794) # Backport This will backport the following commits from `main` to `8.18`: - [[server-route-repository] Only validate zod schema effects in dev mode (#210412)](#210412) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-12T11:28:10Z","message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:Obs AI Assistant","Team:obs-ux-management","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"[server-route-repository] Only validate zod schemas in dev mode","number":210412,"url":"https://github.com/elastic/kibana/pull/210412","mergeCommit":{"message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210412","number":210412,"mergeCommit":{"message":"[server-route-repository] Only validate zod schema effects in dev mode (#210412)\n\nIn #208166, we added a validation\r\nstep that verifies that all zod schemas:\r\na) Are built with supported types, meaning types that we can analyze for\r\nif they are applied strictly (no excess keys)\r\nb) Are built with any side effects (refine or transform, which may\r\nimpact the type reliability)\r\n\r\nThis doesn't impact the actual parameter validation, but is instead an\r\nadditional check on the schemas we're using.\r\nFor any violation found, we log a warning, this has the downside of\r\nincreasing our total log volume and is only really needed in development\r\nmode.\r\n\r\nHence, in this PR, we're only logging these warnings if Kibana is\r\nrunning in dev mode, and the PR updates all consuming plugins to pass\r\nthis context along.","sha":"42f5b0ba170e49db54e0aef5d56e255659484365"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Milton Hultgren <[email protected]>
In #208166, we added a validation step that verifies that all zod schemas:
a) Are built with supported types, meaning types that we can analyze for if they are applied strictly (no excess keys)
b) Are built with any side effects (refine or transform, which may impact the type reliability)
This doesn't impact the actual parameter validation, but is instead an additional check on the schemas we're using.
For any violation found, we log a warning, this has the downside of increasing our total log volume and is only really needed in development mode.
Hence, in this PR, we're only logging these warnings if Kibana is running in dev mode, and the PR updates all consuming plugins to pass this context along.