Our OpenAPI spec defines maps in the following manner:
"Silo": {
"description": "View of a Silo\n\nA Silo is the highest level unit of isolation.",
"type": "object",
"properties": {
"mapped_fleet_roles": {
"description": "Mapping of which Fleet roles are conferred by each Silo role\n\nThe default is that no Fleet roles are conferred by any Silo roles unless there's a corresponding entry in this map.",
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"$ref": "#/components/schemas/FleetRole"
},
"uniqueItems": true
}
}
},
"required": [
"mapped_fleet_roles",
]
}
In this scenario this should be parsed into
type Silo struct {
// MappedFleetRoles is mapping of which Fleet roles are conferred by each Silo role
//
// The default is that no Fleet roles are conferred by any Silo roles unless there's a corresponding entry in this map.
MappedFleetRoles map[string][SiloRole]FleetRole `json:"mapped_fleet_roles,omitempty" yaml:"mapped_fleet_roles,omitempty"`
}
But, our API spec makes no mention of SiloRole. To avoid making any hardcoded one-offs, we will be setting the map key to be a string. This should be changed once our OpenAPI spec mentions the key type
Our OpenAPI spec defines maps in the following manner:
In this scenario this should be parsed into
But, our API spec makes no mention of
SiloRole
. To avoid making any hardcoded one-offs, we will be setting the map key to be a string. This should be changed once our OpenAPI spec mentions the key type