Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve parameter option encoding/decoding #21476

Closed
liggitt opened this issue Feb 18, 2016 · 6 comments
Closed

Improve parameter option encoding/decoding #21476

liggitt opened this issue Feb 18, 2016 · 6 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.

Comments

@liggitt
Copy link
Member

liggitt commented Feb 18, 2016

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

@pwittrock pwittrock added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Feb 18, 2016
@liggitt liggitt closed this as completed Feb 3, 2017
@liggitt liggitt reopened this Feb 3, 2017
@techtonik
Copy link

Is there anything going on about this ticket?

@liggitt
Copy link
Member Author

liggitt commented May 11, 2017

not currently, no

@techtonik
Copy link

@liggitt any ideas how to make parameters encoding/decoding symmetric?

@techtonik
Copy link

If I understand correctly. golang allow to annotate structures, and these annotations could be used for operations. What I don't like about the API is that it operates on parameters indirectly.

runtime.NewParameterCodec(...).DecodeParameters()

It would be more readable for me to see:

runtime.params = UpdateFromPOST()

or something like this.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 24, 2017
@liggitt
Copy link
Member Author

liggitt commented Jan 16, 2018

/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery.
Projects
None yet
Development

No branches or pull requests

5 participants