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

Ion to Json task fails when Ion file contains type annotation #138

Open
ReLoutre opened this issue Sep 20, 2024 · 7 comments
Open

Ion to Json task fails when Ion file contains type annotation #138

ReLoutre opened this issue Sep 20, 2024 · 7 comments
Assignees
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working enhancement New feature or request

Comments

@ReLoutre
Copy link

ReLoutre commented Sep 20, 2024

Describe the issue

Using IonToJson task on a file that contains a type annotated value produce infinite nested call of IonSystemLite['loader"] and IonStringLite["system"].

Bug reproduction

Here's a flow to reproduce the error :

id: bug_reproduction
namespace: bloup

inputs:
  - id: test_ref_file
    type: FILE

tasks:
  - id: downgrade_Ion_to_Json
    type: io.kestra.plugin.serdes.json.IonToJson
    from: "{{inputs.test_ref_file}}"

Here's the content of the file to input in the flow :

{someKey:"someValue",attributes:{description:["Some not encoded text"]}}
{someKey:"someValue",attributes:{description:[base64::"TGlzmlhbGUgZGUgbCdJVVQ="]}}
{someKey:"someValue",attributes:{description:["Some not encoded text", "and some more"]}}

Removing the type annotation base64:: works fine.

Expecting behaviour :

While downgrading to JSON type annotation may be totally erased or concerned field may be translated as :

{someKey:"someValue",attributes:{description:[base64::"TGlzmlhbGUgZGUgbCdJVVQ="]}}
->
{"someKey":"someValue","attributes":{"description":[{"annot":"base64","value":"TGlzmlhbGUgZGUgbCdJVVQ="}]}}

For example...

Environment

  • Kestra Version: 0.18.4
  • Operating System (OS/Docker/Kubernetes): Docker

Error encountered

image

@ReLoutre ReLoutre added the bug Something isn't working label Sep 20, 2024
@Ben8t Ben8t changed the title Downgrading Ion file that contains type annotation fail Ion to Json task fails when Ion file that contains type annotation Sep 20, 2024
@Ben8t
Copy link
Member

Ben8t commented Sep 20, 2024

Up to implementation, but we could also add a flag to let the user choose the behavior intented (ie. remove annotation metadata from JSON or add a field annotation in the corresponding JSON key-value)

@Ben8t Ben8t transferred this issue from kestra-io/kestra Sep 20, 2024
@Ben8t Ben8t added enhancement New feature or request area/plugin Plugin-related issue or feature request labels Sep 20, 2024
@ReLoutre
Copy link
Author

Up to implementation, but we could also add a flag to let the user choose the behavior intented (ie. remove annotation metadata from JSON or add a field annotation in the corresponding JSON key-value)

Being able to do both would indeed be awesome.
PS: "annot":"base64" must be "annots":["base64"] instead. Since multiple annotations may be attached to a single value.

@ReLoutre ReLoutre changed the title Ion to Json task fails when Ion file that contains type annotation Ion to Json task fails when Ion file contains type annotation Sep 20, 2024
@loicmathieu
Copy link
Member

It seems to be a bug with the IonMapper, I'll try to create a reproducer to open a bug upstream.

@loicmathieu loicmathieu self-assigned this Sep 20, 2024
@loicmathieu
Copy link
Member

@ReLoutre can you add in a comment the way to generate this base64 annotated field?

@ReLoutre
Copy link
Author

ReLoutre commented Sep 23, 2024

In my case I'm using the Java com.amazon.ion.IonWriter class (here's the doc) and use it like following : ionWriter.addTypeAnnotation("base64"); (here's the doc).

@ReLoutre
Copy link
Author

PS: Take note that TGlzmlhbGUgZGUgbCdJVVQ= in my example doesn't mean anything in base 64 and may not even be a valid base64 encoding, yet it is solely stored as a string annotated and so it shouldn't have a link with the problem.

@ReLoutre
Copy link
Author

In my opinion, the problem is highly related to the following issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

3 participants