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

Set 'id' field when deserializing a PutPipelineRequest #790

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

patschl
Copy link
Contributor

@patschl patschl commented Dec 31, 2023

Description

Currently deserializing a PutPipelineRequest it not possible due to the id field not being set but also being required during deserialization.
This PR adds support for the id field.

Issues Resolved

Fixes #789

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.

Signed-off-by: Patrick Schlindwein <[email protected]>
Signed-off-by: Patrick Schlindwein <[email protected]>
@patschl patschl force-pushed the put_pipeline_request_id_deserialization branch from b2e75f4 to ab53a74 Compare December 31, 2023 14:43
@@ -481,6 +481,7 @@ protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer<Put

op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta");
op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description");
op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id");
Copy link
Collaborator

Choose a reason for hiding this comment

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

@patschl the PutPipelineRequest does not include id as the payload - it is part of the URL and passed as the URL path component. Under which circumstances it is returned in the request payload? Could you please share the example? (sadly the linked issue has no payload sample).

Copy link
Contributor Author

@patschl patschl Jan 1, 2024

Choose a reason for hiding this comment

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

Thanks @reta!
I'm not quite sure I understand the purpose of this deserializer correctly if it should strictly deal with the payload of a request.
id is a required field for the PutPipelineRequest, so deserializing will currently fail every time, since the deserializer of course does not set it. Wouldn't this make the deserializer unnecessary if it won't work anyway?

We had a similar issue with the name property in the PutIndexTemplateRequest, but managed to work around it.

We persist such index template and pipeline definitions as json in our VCS and create the requests using the objects _DESERIALIZER implementations, this is the reason for this PR.

Copy link
Collaborator

@reta reta Jan 2, 2024

Choose a reason for hiding this comment

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

Thanks @patschl

I'm not quite sure I understand the purpose of this deserializer correctly if it should strictly deal with the payload of a request.

The deserializer mirrors serializer: in this particular case, the id is not part of the serialized JSON (payload) and as such, should not be deserialized from the payload (since it should not be there in the first place).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@reta Okay I see, I will close this PR then. Thank you for clearing that up.
There is no way to create this object from a json using this deserializer, but I guess this was never the use case anyway?

Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no way to create this object from a json using this deserializer, but I guess this was never the use case anyway?

Thank you @patschl, I think the question is under which circumstances it should happen, this is a request which naturally only uses one way serialization (when send to the service). But in general - yes, it seems like some models may need more context (URI components) to deserialize completely.

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

Successfully merging this pull request may close these issues.

[BUG] PutPipelineRequest not deserializable due to missing id field
2 participants