-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Remove Booleans use from XContent and ToXContent #28768
Conversation
This removes the use of the `common.Boolean` class from two of the XContent classes, so they can be decoupled from the ES code as much as possible. Related to elastic#28754, elastic#28504
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 think I miss something here which is why not move Booleans
to the core library?
Regarding es.xcontent.strict_duplicate_detection
I do wonder if this property is necessary. Is there an open issue to discuss removing this property? Can we consider removing this property in 7.0.0?
FYI @elastic/es-core-infra. |
We talked about making sure the xcontent can go into its own library that doesn't depend on the core library. Moving Booleans to the core library wouldn't let us use it here.
Sure! This change has to go back to 6.x so maybe we should talk about doing that as a follow up? |
I think I want to reconsider this now that the consequences are more in my face. There is something wrong if we are going to start duplicating such basic code. |
Okay, with our original constraints we wanted to have XContent be a library in There are a few options:
Did I miss any options? What do we think is best here? |
I hope you publish this new standalone xcontent lib. I would love to use this outside of elasticsearch! |
/cc @elastic/es-core-infra |
@jasontedor I made the changes we discussed about keeping it as duplication, but in a helper |
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 left one more comment, no need for another round.
* default value if null or the empty string is used. Any other input | ||
* results in an {@link IllegalArgumentException} being thrown. | ||
*/ | ||
static boolean parseBoolean(String value, Boolean defaultValue) { |
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.
Would you move this to a package-visible class named Booleans
? There is no confusion with the other Booleans
because of package visibility. It does not make sense on this class, it does not make sense on the other class, and the name will help for ease of finding in the future if needed.
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.
Certainly, I'll do that.
Thanks everyone |
* Remove Booleans use from XContent and ToXContent This removes the use of the `common.Boolean` class from two of the XContent classes, so they can be decoupled from the ES code as much as possible. Related to elastic#28754, elastic#28504
* master: (28 commits) Maybe die before failing engine (elastic#28973) Remove special handling for _all in nodes info Remove Booleans use from XContent and ToXContent (elastic#28768) Update Gradle Testing Docs (elastic#28970) Make primary-replica resync failures less lenient (elastic#28534) Remove temporary file 10_basic.yml~ Use different pipeline id in test. (pipelines do not get removed between tests extending from ESIntegTestCase) Use fixture to test the repository-gcs plugin (elastic#28788) Use String.join() to describe a list of tasks (elastic#28941) Fixed incorrect test try-catch statement Plugins: Consolidate plugin and module loading code (elastic#28815) percolator: Take `matchAllDocs` and `verified` of the sub result into account when analyzing a function_score query. Build: Remove rest tests on archive distribution projects (elastic#28952) Remove FastStringReader in favor of vanilla StringReader (elastic#28944) Remove FastCharArrayReader and FastCharArrayWriter (elastic#28951) Continue registering pipelines after one pipeline parse failure. (elastic#28752) Build: Fix ability to ignore when no tests are run (elastic#28930) [rest-api-spec] update doc link for /_rank_eval Switch XContentBuilder from BytesStreamOutput to ByteArrayOutputStream (elastic#28945) Factor UnknownNamedObjectException into its own class (elastic#28931) ...
This removes the use of the
common.Boolean
class from two of the XContentclasses, so they can be decoupled from the ES code as much as possible.
Related to #28754, #28504