Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Optionals #7

@ufukty

Description

@ufukty

Current behavior

Currently marking targets as optionals is not possible. The resulting struct will contain basic/composed type regardless.

struct Config type {
  A int `yaml:"a"`
}

Proposed behavior

Providing an interface to user to let specify which targets can be optional. Then, implement additional types based on contains the value as a field, and also contains the state of value in another field, named IsSet.

type Optional[T any] struct {
  Value T
  IsSet bool
}

struct Config type {
  A Optional[int] `yaml:"a"`
}

See also

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions