Feature Request: Enable Default Value Setting in Schemas via Unaltered Struct Field Names
- Dominant language
- Go
- Stars
- 952
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
## Feature Request
**Problem**
When generating a schema, it would be beneficial to have the capability to set default values using an instance of the struct that is being converted into a schema.
Currently, this is challenging because the name specified in the struct tags may not correspond to the actual name of the struct field in the code, which makes it difficult to match the fields using their names.
**Proposed Solution**
To resolve this, we could include the original name of the struct field—unmodified by struct tags—in the schema. This would preserve the ability to match the fields based on their original names in the code, facilitating the setting of default values.
**Alternatives Considered**
An alternative method I have considered involves replacing the field name of the instantiated object with the name specified in the tag and using that for matching. However, this approach does not fully address the problem, as the name from the tag might be altered by a function like `KeyNamer`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.