-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
I think that requiring fields that have a valid default makes the API awkward. ie, the below code should be allowed.
EDIT: I just noticed that #[builder(default = ...)] exists, but that seems like overkill when optional makes the most sense. Perhaps #[builder(optional)] could be inferred to always be #[builder(default = "Default::default()"]?
/// Represents a configuration schema object (type definition)
#[derive(Debug, Clone, Serialize, Deserialize, Builder)]
pub struct ConfigSchemaObject {
/// Name of the type (e.g., "cfg::Config", "cfg::Auth")
#[builder(required)]
pub name: String,
/// List of ancestor type IDs
#[builder(optional)]
pub ancestors: Vec<ConfigSchemaTypeReference>,
/// Properties of this type
#[builder(required)]
pub properties: Vec<ConfigSchemaProperty>,
/// Links (relationships) to other types
#[builder(required)]
pub links: Vec<ConfigSchemaLink>,
}tomoikey
Metadata
Metadata
Assignees
Labels
No labels