Skip to content

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

Closed

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

Activity

  1. kyleconroy commented on Jun 26, 2020

    @kyleconroy
    Collaborator

    We were going to switch to is_null, but I think nullable is much better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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