[Console] Implement logic to generate body params#161684
[Console] Implement logic to generate body params#161684yuliacech wants to merge 15 commits intoelastic:mainfrom
Conversation
## Summary Related to #159041 While working on #161684, I noticed another unused function. There is no usage in the code base of the "extensions" function and I think it would be better to delete it from Console. That makes the remaining code that we need to work with easier to understand. ### Release note The function `addExtensionSpecFilePath` is removed from the Console plugin setup contract (server side).
💚 Build Succeeded
Metrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
|
Pinging @elastic/platform-deployment-management (Team:Deployment Management) |
|
Great work @yuliacech! I tested manually around 10-15 randomly picked endpoints with body params and most of them worked as expected. I only noticed some potential issues in two of them:
I know these are more complex cases, but for the basic body params the suggestions are great! 🎉 |
|
Thanks a lot for your review, @ElenaStoeva! I'will close this PR for now following the discussion in the team sync. We will not generate request body parameters with the new script for now, because that brings too many risks to the next release. This work will be continued later as an improvement for Console autocomplete generation process. |

Summary
Fixes #160533
This PR is a follow up to work done in #159241 and #160515. The new logic added is to generate body params definitions from the ES specification. The old
spec-to-consolespec doesn't generate any parameters for request body, because this information is not included into JSON specs. So all autocomplete definitions for Console were created manually: see foldersjsandoverrides.The new script converts the types included in the specification to create an object representing request body.
Description
The logic of the body params conversion is in the comments of the file
body_params_converter.ts.I noticed that some types cause an endless loop in the script because they use their own type to describe inner fields recursively. For example, the endpoint
async_search.submithas a fieldcollapsewhich is of typeFieldCollapse. When we look at the typeFieldCollapse, among other fields it has a nested fieldcollapsewhich is of typeFieldCollapse. With such nested recursion it would be impossible to describe this endpoint in a simple json structure. So we have to extract this type into a separate definition and link to it withlink_scope. The type then needs to be loaded asglobalrule similar to definitions in the folderjs.That is why this PR moves the endpoints definitions from the folder
generatedto the foldergenerated/endpointsand creates a new foldergenerated/globals. This folder is empty for now and will contain the global definitions when the new script will be used.How to test
node scripts/generate_console_definitions.js --source /Users/yulia/elastic/elasticsearch-specificationspec_definitions_service.tscomment out line 89 like so//this.loadJSSpec();. This is needed to prevent loading manually defined global rules.Known issues
configurationswhich is not correct according to the ILM API. This needs to be addressed directly in the ES specification repo.