currently for a Parsable it has to implement both serialization and deserialization, and while technically there are work arounds to only implement on or the other within golang it's preferred to have an interface only implement what is minimally required.
current:
// Parsable defines a serializable model object.
type Parsable interface {
// Serialize writes the objects properties to the current writer.
Serialize(writer SerializationWriter) error
// GetFieldDeserializers returns the deserialization information for this object.
GetFieldDeserializers() map[string]func(ParseNode) error
}
proposed:
// Serializable defines a model that can be serialized
type Serializable interface {
// Serialize writes the objects properties to the current writer.
Serialize(writer SerializationWriter) error
}
// Deserializable defines a model that can be deserialized
type Deserializable interface {
// GetFieldDeserializers returns the deserialization information for this object.
GetFieldDeserializers() map[string]func(ParseNode) error
}
// for compatibility
// Parsable defines a serializable model object.
type Parsable interface {
Serializable
Deserializable
}
currently for a Parsable it has to implement both serialization and deserialization, and while technically there are work arounds to only implement on or the other within golang it's preferred to have an interface only implement what is minimally required.
current:
proposed: