Merge pull request #114786 from CatherineF-dev/update-doc

Update doc about json tag is needed to generate informer externalversion package

Kubernetes-commit: 7fd0ff5761103ae3b3f9335cbca270ff3b052a6c
This commit is contained in:
Kubernetes Publisher 2023-01-05 09:12:11 -08:00
commit 2307facf35

View File

@ -126,6 +126,8 @@ type User struct {
}
```
Note, the JSON tag `json:` is required on all user facing fields within your type. Typically API types contain only user facing fields. When the JSON tag is omitted from the field, Kubernetes generators consider the field to be internal and will not expose the field in their generated external output. For example, this means that the field would not be included in a generated CRD schema.
## Validation
To validate custom resources, use the [`CustomResourceValidation`](https://kubernetes.io/docs/tasks/access-kubernetes-api/extend-api-custom-resource-definitions/#validation) feature. Validation in the form of a [structured schema](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#specifying-a-structural-schema) is mandatory to be provided for `apiextensions.k8s.io/v1`.