Skip to content

Serialization - 1000 cuts #363

@jlpedrosa

Description

@jlpedrosa

Hi @vaerh

I got myself into another pitfal because how we serialize the objects and the default values. In this case, the defaults was overriding a behavior when some field is unset. (BGP timers).

In other cases we found defaults that change over time. We tried the "AlwaysPresentUserNotProvided", but that also comes with it's own problems.

I think we need a mechanism to have more fine grained control how the fields are serialised when the user provides it, or how to behave when the router provided it and the user didn't At the same time,terraform schema has it's own limitations.

I think there are multiple ways to tackle this.
Struct holding schema and serialization options per field, ie:

type Field struct {
  *schema.Schema
  *routeros.Serialization 
}

Or having object types per resource with tags, ie:

type InterfaceBridgeXX struct {
   MacAddress string `routeros:"ommitempty, ...."`
}

Any option in this sense would be a really big swing and a big task (that could be done progressively). Are you open to any of this ideas? (or any other way to take on the problem)?

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