Skip to content

Treat unspecified keys as their default value if provided #83

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

Closed
wants to merge 1 commit into from

Conversation

jennybuckley
Copy link

Replacement for #79
Relies on default key values being part of the schema so we can treat null as that value when constructing field paths, instead of actually doing defaulting.

Probably won't allow this except for some existing cases like containerPorts

cc @apelisse

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 29, 2019
@k8s-ci-robot k8s-ci-robot requested review from apelisse and lavalamp May 29, 2019 22:09
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jennybuckley

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 29, 2019
@jennybuckley jennybuckley changed the title Default unspecified values of unspecified key fields in associative lists Treat unspecified keys as their default value if provided May 30, 2019
@apelisse
Copy link
Contributor

apelisse commented Jun 3, 2019

How do you plan on generating the default field value?

@jennybuckley
Copy link
Author

Talked offline, but I'll write it here too.

The plan is to get this from the openapi, and that will come from the default markers in types.go that are going to eventually be defined. Like:

// types.go
type Foo struct {
  // +default={"bar": "abc"}
  Foo *Bar
}
# openapi
{"properties": {"name": "foo", ... "default": {"bar": "abc"}}}
# schema.List
defaultedKeys:
- fieldName: foo
  defaultValue: "{\"bar\": \"abc\"}"

@apelisse
Copy link
Contributor

apelisse commented Jun 3, 2019

Right, I like that idea.

Are we going to generate defaultedKeys only for keys or for all values?

@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.

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 Sep 1, 2019
@jennybuckley
Copy link
Author

rebased

@jennybuckley jennybuckley force-pushed the default-2 branch 2 times, most recently from bedde8c to 0ba4282 Compare September 25, 2019 18:31
@jennybuckley
Copy link
Author

#83 (comment)

I think only for defaulted keys, but that can be decided once we are integrating this into kube-openapi

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

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 rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Oct 25, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closed this PR.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants