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

Represent null value #78

Open
cowboyd opened this issue Feb 13, 2023 · 0 comments
Open

Represent null value #78

cowboyd opened this issue Feb 13, 2023 · 0 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@cowboyd
Copy link
Member

cowboyd commented Feb 13, 2023

null is a valid both as a YAML value, and also as a key in a YAML mapping, but we don not support it.

https://yaml.org/type/null.html

I was hoping to avoid null entirely, but it looks like maybe we can't since lots of YAML in the wild contains null mappings. E.g. this example from the Score documentation

apiVersion: score.dev/v1b1

metadata:
  name: backend

containers:
  container-id:
    image: busybox
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo Hello $${FRIEND}!; sleep 5; done"]
    variables:
        CONNECTION_STRING: postgresql://${resources.db.username}:${resources.db.password}@${resources.db.host}:${resources.db.port}/${resources.db.name}

resources:
  db:
    type: postgres
    properties:
      host:
      port:
        default: 5432
      name:
      username:
        secret: true
      password:
        secret: true

In it, resources.db.host, and resources.db.name are both null literals. These properties are equivalent to saying:

host: null
name: null

or

host: ~
name: ~

As much as I would like to not have null in PlatformScript at all, if we want all YAML values to be valid platform script, as well as to deserialize and serialize back all wild programs, we will need to support it.

I would love for someone to prove me wrong.

@cowboyd cowboyd added bug Something isn't working enhancement New feature or request labels Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant