Merge pull request #12992 from pmorie/description_checker

Make description checker check for descriptions in internal API
This commit is contained in:
Saad Ali 2015-08-20 17:32:44 -07:00
commit 93ffc9c57e
2 changed files with 20 additions and 14 deletions

View File

@ -38,18 +38,24 @@ find_files() {
} }
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
files=`find_files | egrep "pkg/api/v.[^/]*/types\.go"` versioned_api_files=`find_files | egrep "pkg/api/v.[^/]*/types\.go"`
else else
files=("${@}") versioned_api_files=("${@}")
fi fi
for file in $files; do for file in $versioned_api_files; do
if grep json: "${file}" | grep -v // | grep -v ,inline | grep -v -q description: ; then if grep json: "${file}" | grep -v // | grep -v ,inline | grep -v -q description: ; then
echo "API file is missing the required field descriptions: ${file}" echo "API file is missing the required field descriptions: ${file}"
result=1 result=1
fi fi
done done
internal_types_file="${KUBE_ROOT}/pkg/api/types.go"
if grep json: "${internal_types_file}" | grep -v // | grep description: ; then
echo "Internal API types should not contain descriptions"
result=1
fi
exit ${result} exit ${result}
# ex: ts=2 sw=2 et filetype=sh # ex: ts=2 sw=2 et filetype=sh

View File

@ -728,8 +728,8 @@ type Container struct {
// Variables for interactive containers, these have very specialized use-cases (e.g. debugging) // Variables for interactive containers, these have very specialized use-cases (e.g. debugging)
// and shouldn't be used for general purpose containers. // and shouldn't be used for general purpose containers.
Stdin bool `json:"stdin,omitempty" description:"Whether this container should allocate a buffer for stdin in the container runtime; default is false"` Stdin bool `json:"stdin,omitempty"`
TTY bool `json:"tty,omitempty" description:"Whether this container should allocate a TTY for itself, also requires 'stdin' to be true; default is false"` TTY bool `json:"tty,omitempty"`
} }
// Handler defines a specific action that should be taken // Handler defines a specific action that should be taken
@ -2212,30 +2212,30 @@ type RangeAllocation struct {
// types to the API. It consists of one or more Versions of the api. // types to the API. It consists of one or more Versions of the api.
type ThirdPartyResource struct { type ThirdPartyResource struct {
TypeMeta `json:",inline"` TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"` ObjectMeta `json:"metadata,omitempty"`
Description string `json:"description,omitempty" description:"The description of this object"` Description string `json:"description,omitempty"`
Versions []APIVersion `json:"versions,omitempty" description:"The versions for this third party object"` Versions []APIVersion `json:"versions,omitempty"`
} }
type ThirdPartyResourceList struct { type ThirdPartyResourceList struct {
TypeMeta `json:",inline"` TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://docs.k8s.io/api-conventions.md#metadata"` ListMeta `json:"metadata,omitempty"`
Items []ThirdPartyResource `json:"items" description:"items is a list of schema objects"` Items []ThirdPartyResource `json:"items"`
} }
// An APIVersion represents a single concrete version of an object model. // An APIVersion represents a single concrete version of an object model.
type APIVersion struct { type APIVersion struct {
Name string `json:"name,omitempty" description:"name of this version (e.g. 'v1')"` Name string `json:"name,omitempty"`
APIGroup string `json:"apiGroup,omitempty" description:"The API group to add this object into, default 'experimental'"` APIGroup string `json:"apiGroup,omitempty"`
} }
// An internal object, used for versioned storage in etcd. Not exposed to the end user. // An internal object, used for versioned storage in etcd. Not exposed to the end user.
type ThirdPartyResourceData struct { type ThirdPartyResourceData struct {
TypeMeta `json:",inline"` TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"` ObjectMeta `json:"metadata,omitempty"`
Data []byte `json:"name,omitempty" description:"the raw JSON data for this data"` Data []byte `json:"name,omitempty"`
} }