Skip to content

Represent null value #78

Open
Open
@cowboyd

Description

@cowboyd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions