- Notifications
You must be signed in to change notification settings - Fork 115
Fix optional bodies #5271
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
Fix optional bodies #5271
Conversation
Following you can find the validation changes against the target branch for the API.
You can validate this API yourself by using the |
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.
For each change, I have linked the corresponding server code justifying the change and sometimes additional evidence.
master_timeout?: Duration | ||
} | ||
body: { | ||
body?: { |
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.
sort?: string | string[] | ||
} | ||
body: { | ||
body?: { |
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.
master_timeout?: Duration | ||
} | ||
body: { | ||
body?: { |
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.
timeout?: Duration | ||
} | ||
body: { | ||
body?: { |
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.
/** @codegen_name index_template */ | ||
body?: IndexTemplate |
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.
debug?: boolean | ||
} | ||
body: { | ||
body?: { |
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.
} | ||
] | ||
body: { | ||
body?: { |
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.
id?: Id | ||
} | ||
body: { | ||
body?: { |
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.
include_defaults?: boolean | ||
} | ||
body: { | ||
body?: { |
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.
} | ||
/** @codegen_name create_from */ | ||
body: CreateFrom | ||
body?: CreateFrom |
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.
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.
ML & Transform changes 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.
Added two APIs which I initially thought required a body. The server code was unclear, but the YAML tests provided clarity.
wait_for_completion?: boolean | ||
} | ||
body: { | ||
body?: { |
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.
YAML test that creates a snapshot without a body: https://github.com/elastic/elasticsearch/blob/a82b5cfb0ff7d22b95c56a8e7dcd7c5f3ba4ff24/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/snapshot.create/10_basic.yml#L23-L27
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.
wait_for_completion?: boolean | ||
} | ||
body: { | ||
body?: { |
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.
YAML test that restores a snapshot without a body: https://github.com/elastic/elasticsearch/blob/a82b5cfb0ff7d22b95c56a8e7dcd7c5f3ba4ff24/modules/repository-gcs/src/yamlRestTest/resources/rest-api-spec/test/repository_gcs/20_repository.yml#L139-L144
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.
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, and thanks for the detailed comments @pquentin!
* Fix optional bodies * Mark snapshot.create/snapshot.restore bodies as optional too (cherry picked from commit 3348b2f)
* Fix optional bodies * Mark snapshot.create/snapshot.restore bodies as optional too (cherry picked from commit 3348b2f)
Many bodies were correctly set as optional in the rest-api-spec, but incorrectly set as required in the Elasticsearch specification. There are three errors in rest-api-spec too. When I fix them, I can commit the compiler change that allowed me to see this.