Skip to content

Instantly share code, notes, and snippets.

@pwittrock
Created March 16, 2017 19:58
Show Gist options
  • Save pwittrock/5d58429de105c492b54c7493cc70c8c4 to your computer and use it in GitHub Desktop.
Save pwittrock/5d58429de105c492b54c7493cc70c8c4 to your computer and use it in GitHub Desktop.

Definition

type OpenAPIDefinition struct {
	Schema       spec.Schema
	Dependencies []string
}

Instantiation

"k8s.io/sample-apiserver/apis/wardle/v1alpha1.Flunder": {
			Schema: spec.Schema{
				SchemaProps: spec.SchemaProps{
					Properties: map[string]spec.Schema{
						"kind": {
							SchemaProps: spec.SchemaProps{
								Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
								Type:        []string{"string"},
								Format:      "",
							},
						},
						"apiVersion": {
							SchemaProps: spec.SchemaProps{
								Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
								Type:        []string{"string"},
								Format:      "",
							},
						},
						"metadata": {
							SchemaProps: spec.SchemaProps{
								Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
							},
						},
						"spec": {
							SchemaProps: spec.SchemaProps{
								Ref: ref("k8s.io/sample-apiserver/apis/wardle/v1alpha1.FlunderSpec"),
							},
						},
						"status": {
							SchemaProps: spec.SchemaProps{
								Ref: ref("k8s.io/sample-apiserver/apis/wardle/v1alpha1.FlunderStatus"),
							},
						},
					},
				},
			},
			Dependencies: []string{
				"k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/sample-apiserver/apis/wardle/v1alpha1.FlunderSpec", "k8s.io/sample-apiserver/apis/wardle/v1alpha1.FlunderStatus"},
			spec.VendorExtensible: {
				Extensions: spec.Extensions{
					"x-kubernetes-api-type": "true",
					"x-kubernetes-version":  "v1alpha1",
					"x-kubernetes-group":    "wardle",
					"x-kubernetes-kind":     "Flunder",
				},
			},

Error message

go build main.go
# k8s.io/sample-apiserver/pkg/openapi
pkg/openapi/openapi_generated.go:7468: unknown openapi.OpenAPIDefinition field 'spec.VendorExtensible' in struct literal

Analysis

  • There is not field of type spec.VendorExtensible in the OpenAPIDefinition type
  • spec.VendorExtensible: { is a type, not a field name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment