Skip to content

Using "null" YAML keyword as setting in overrides is problematic #570

@netrounds-joakim

Description

@netrounds-joakim

These settings will result in an invalid config:

...
overrides:
  - go_type: "encoding/json.RawMessage"
    db_type: "json"
  - db_type: "uuid"
    null: true
    go_type: "*github.com/google/uuid.UUID"

The reason is tha null is a Keyword in YAML. However, this would be fine if I simply got an error using this invalid config. But I don't. instead the null value above is silently ignored and will always default to false.

I can fix the issue by quoting 'null' like this:

...
overrides:
  - go_type: "encoding/json.RawMessage"
    db_type: "json"
  - db_type: "uuid"
    'null': true
    go_type: "*github.com/google/uuid.UUID"

However, I think this setting name should be deprecated and something like nullable being used instead, and printing some type of warning or similar

https://github.com/kyleconroy/sqlc/blob/fa7660c700757b2654084a0c1a6ad227b7376b42/internal/config/config.go#L142-L143

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions