Skip to content

Improve parameter option encoding/decoding #21476

Closed
@liggitt

Description

Follow up from #21398

Parameter encoding/decoding follows an odd and asymmetric path today:

Encoding:

runtime.NewParameterCodec(...).EncodeParameters(runtime.Object, destination groupversion)
  -> queryparams.Convert(runtime.Object)
    uses json tag names as parameter names
    primitive values are added as query parameter string values
    struct values (currently only unversioned.Time) can convert themselves to a query parameter string value

Decoding:

runtime.NewParameterCodec(...).DecodeParameters(url.Values, source groupversion, destination object)
  -> conversion.convert(url.Values, versioned destination object)
    uses defined conversion functions between `*[]string` and field types to convert url query parameters to options structs

I'm not sure we want lots of arbitrary struct->queryparam serialization, but these paths should be more unified.

cc @smarterclayton

Metadata

Assignees

No one assigned

    Labels

    lifecycle/staleDenotes an issue or PR has remained open with no activity and has become stale.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions