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

Avoid serializing empty strings #1022

Closed
lordrip opened this issue Apr 18, 2024 · 3 comments · Fixed by #1028, #1198 or #1203
Closed

Avoid serializing empty strings #1022

lordrip opened this issue Apr 18, 2024 · 3 comments · Fixed by #1028, #1198 or #1203
Assignees
Labels
bug Something isn't working canvas/config-form Configuration form related issues good first issue Good for newcomers help wanted Extra attention is needed source code editor Source Code Editor-related issues
Milestone

Comments

@lordrip
Copy link
Member

lordrip commented Apr 18, 2024

Describe the Bug

In case a string field is touched and later on clean, the resulting YAML looks like the following:

property: ""

This is an issue for the expression field in which the resultType property gets an empty string and it makes the route to fail.

              - expression:
                  simple:
                    expression: ${body[0]}
                    resultType: ""

Steps to Reproduce the Bug or Issue

  1. Using a setHeader EIP, edit the resultType property
  2. Clean the field
  3. Check how the resultType property is now an empty string

Screenshots or Videos

No response

Platform

  • OS: [e.g. macOS, Windows, Linux]
  • Browser: [e.g. Chrome, Safari, Firefox]
  • Version: [e.g. 0.30.0]
@lordrip lordrip added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed source code editor Source Code Editor-related issues canvas/config-form Configuration form related issues labels Apr 18, 2024
@lhein lhein added this to the 2.0.0 milestone Apr 23, 2024
@lordrip lordrip self-assigned this Apr 23, 2024
lordrip added a commit to lordrip/kaoto that referenced this issue Apr 23, 2024
Currently, when a string field is touched and later on clean, the resulting YAML looks like the following:
```
property: ''
```

And this represents an issue since many properties can't be left blank.

This commit avoids serializing empty `''` strings by replace them with
`undefined` instead.

fix: KaotoIO#1022
lordrip added a commit that referenced this issue Apr 23, 2024
Currently, when a string field is touched and later on clean, the resulting YAML looks like the following:
```
property: ''
```

And this represents an issue since many properties can't be left blank.

This commit avoids serializing empty `''` strings by replace them with
`undefined` instead.

fix: #1022
@lordrip
Copy link
Member Author

lordrip commented Jun 14, 2024

This looks like is happening again, reopening.

@tplevko
Copy link
Contributor

tplevko commented Jun 25, 2024

It's still occurring in case the fields are a part of an expression:

Screenshot from 2024-06-25 12-30-51

Should I reopen this issue or create new one for expressions only?

@lordrip
Copy link
Member Author

lordrip commented Jun 25, 2024

Reopening issue as there another case to take into account

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working canvas/config-form Configuration form related issues good first issue Good for newcomers help wanted Extra attention is needed source code editor Source Code Editor-related issues
Projects
Archived in project
4 participants