Skip to content
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

Generate more indices operations #1358

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Xtansia
Copy link
Collaborator

@Xtansia Xtansia commented Dec 15, 2024

Description

Generate more indices operations

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

op.add(Builder::analyzer, JsonpDeserializer.stringDeserializer(), "analyzer");
op.add(Builder::attributes, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "attributes");
op.add(Builder::charFilter, JsonpDeserializer.arrayDeserializer(CharFilter._DESERIALIZER), "char_filter");
op.add(Builder::explain, JsonpDeserializer.booleanDeserializer(), "explain");
op.add(Builder::field, JsonpDeserializer.stringDeserializer(), "field");
op.add(Builder::filter, JsonpDeserializer.arrayDeserializer(TokenFilter._DESERIALIZER), "filter");
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index is not part of the JSON payload, is it? (it is URL path parameter)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, we had a few request classes that'd been hand edited to allow deserializing the path params from JSON, so had incorporated it without to avoid breaking changes. See #723

The problem we run into is that requests which have required path parameters are impossible to deserialize otherwise due to the required fields.

But can revert it everywhere if you think?

Copy link
Collaborator

@reta reta Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The index is not part of the JSON payload, is it? (it is URL path parameter)

I think the problem here is that this is not the JSON that will be sent to the server but a workaround to restore the state of the object. Yes, I would revert it everywhere, the path / query / etc params should not be part of the request payload (unless they are repeated for some reasons). Thank you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're only deserializable, they won't be serialized into the JSON sent to the server

Copy link
Collaborator

@reta reta Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, so when they will be serialized into the JSON? More specifically, under which conditions such properties (like index) are going to be serialized (and later deserialized)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that it's being used to construct the request shapes from externally generated JSON.

If we're going to remove the ability to deserialize the path parameters, then we should completely remove deserialization from the request objects as it's unusable in the majority of cases otherwise. Or provide some other mechanism to pass the path (& query) params separate to the JSON payload for deserialization

private final List<ExpandWildcard> expandWildcards;

@Nullable
private final Boolean ignoreUnavailable;

@Nonnull
private final List<String> index;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Nullable
private final Query filter;

@Nonnull
private final List<String> index;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants