Skip to content

Fix default annotation to match JSON property names - #601

Merged
k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
arthurbdiniz:fix/default-annotation-json-case
May 7, 2026
Merged

k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
arthurbdiniz:fix/default-annotation-json-case

Conversation

@arthurbdiniz

@arthurbdiniz arthurbdiniz commented May 7, 2026 •

Copy link
Copy Markdown
Contributor

The SubStruct fields serialize as "S" and "I" in JSON (field name S has no json tag, field I has json:"I,omitempty"), but the +default annotation used lowercase "s" and "i".

// +k8s:openapi-gen=true
type SubStruct struct {
	S string
	// +default=1
	I int `json:"I,omitempty"`
}

This caused the generated OpenAPI spec to advertise a default value with keys that don't correspond to the actual schema property names, producing an invalid default.

This PR updates the +default annotation to {"S": "foo", "I": 5} and regenerates the affected golden files.

The SubStruct fields serialize as "S" and "I" in JSON, but the
+default annotation used lowercase "s" and "i".

Signed-off-by: Arthur Diniz <arthurbdiniz@gmail.com>
@k8s-ci-robot
k8s-ci-robot requested review from Jefftree and sttts May 7, 2026 23:02
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 7, 2026
@Jefftree

Jefftree commented May 7, 2026

Copy link
Copy Markdown
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 7, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: arthurbdiniz, Jefftree

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

The pull request process is described here

Details 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 the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 7, 2026
@k8s-ci-robot
k8s-ci-robot merged commit d05efff into kubernetes:master May 7, 2026
6 checks passed
@arthurbdiniz
arthurbdiniz deleted the fix/default-annotation-json-case branch May 7, 2026 23:20
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. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants