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

[Bug] String with value "null" and empty string in custom arguments are wrongly serialized #627

Closed
Vampire opened this issue Jan 19, 2023 · 2 comments · Fixed by #628
Closed
Labels
bug Something isn't working

Comments

@Vampire
Copy link
Collaborator

Vampire commented Jan 19, 2023

Action

Use these custom arguments for a job:

_customArguments = mapOf(
    "strategy" to mapOf(
        "matrix" to mapOf(
            "distribution" to listOf(
                mapOf(
                    "id" to "invalid",
                    "label" to "invalid"
                ),
                mapOf(
                    "id" to "",
                    "label" to ""
                ),
                mapOf(
                    "id" to null,
                    "label" to "null"
                )
            )
        )
    )
)

Expected

strategy:
    matrix:
        distribution:
            - id: invalid
              label: invalid
            - id: ''
              label: ''
            - id: null
              label: 'null'

Actual

strategy:
  matrix:
    distribution:
    - id: invalid
      label: invalid
    - id:
      label:
    - id: null
      label: null

which is semantically the same as

strategy:
  matrix:
    distribution:
    - id: invalid
      label: invalid
    - id: null
      label: null
    - id: null
      label: null

Library version

v0.34.2

@Vampire Vampire added the bug Something isn't working label Jan 19, 2023
@Vampire Vampire changed the title [Bug] String with value "null" adn empty string in custom arguments are wrongly serialized [Bug] String with value "null" and empty string in custom arguments are wrongly serialized Jan 19, 2023
Vampire added a commit to Vampire/github-workflows-kt that referenced this issue Jan 19, 2023
@krzema12
Copy link
Member

Thanks for reporting!

For completeness, we'll also need to allow nulls as top-level values for custom arguments.

@Vampire
Copy link
Collaborator Author

Vampire commented Jan 20, 2023

Definitely :-)

krzema12 added a commit that referenced this issue Jan 20, 2023
Focusing on custom arguments, but it may be important also for
built-in DSL fields.

Co-authored-by: Björn Kautler <Bjoern@Kautler.net>
Co-authored-by: Piotr Krzeminski <git@krzeminski.it>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants