api/types: fix Plugin.Config.Interface.Types def'n

The wire type of Plugin.Config.Interface.Types is an array of strings,
not of objects with three properties. We just so happen to have a Go
struct type to represent a plugin-interface-type value in memory with
all the fields parsed out for convenience, but that is not part of the
REST API contract documented by the Swager spec.U pdate the Swagger spec
to correctly document that the Types property is an array of strings in
the API, while still generating Go definitions that unmarshal into the
convenient struct type.

Move the definition and marshal/unmarshal methods for
PluginInterfaceType into a more appropriate location than api/types.
Rename the type to one that does not stutter or overload already
heavily overloaded terminology.

Modernize the parser and use property-based testing to assert that it
behaves the same as the old parser for all well-formed inputs.

Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Cory Snider
2025-07-24 18:13:46 -04:00
parent 2783f80ecf
commit ee560a3b23
23 changed files with 243 additions and 174 deletions

View File

@@ -11,4 +11,5 @@ require (
github.com/opencontainers/image-spec v1.1.1
golang.org/x/time v0.11.0
gotest.tools/v3 v3.5.2
pgregory.net/rapid v1.2.0
)