-
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
[Console] Implement logic to generate body params #161684
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-console
spec 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 foldersjs
andoverrides
.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.submit
has a fieldcollapse
which is of typeFieldCollapse
. When we look at the typeFieldCollapse
, among other fields it has a nested fieldcollapse
which 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 asglobal
rule similar to definitions in the folderjs
.That is why this PR moves the endpoints definitions from the folder
generated
to the foldergenerated/endpoints
and 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-specification
spec_definitions_service.ts
comment out line 89 like so//this.loadJSSpec();
. This is needed to prevent loading manually defined global rules.Known issues
configurations
which is not correct according to the ILM API. This needs to be addressed directly in the ES specification repo.