K8s: improve openapi generation (#83796)

This commit is contained in:
Ryan McKinley
2024-03-02 00:26:04 +02:00
committed by GitHub
parent 2184592174
commit d7bcd119c3
15 changed files with 216 additions and 115 deletions
+15 -6
View File
@@ -51,7 +51,7 @@ type DashboardSummaryList struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type DashboardVersionsInfo struct {
type DashboardVersionList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
@@ -60,11 +60,20 @@ type DashboardVersionsInfo struct {
}
type DashboardVersionInfo struct {
Version int `json:"version"`
ParentVersion int `json:"parentVersion,omitempty"`
Created int64 `json:"created"`
Message string `json:"message,omitempty"`
CreatedBy string `json:"createdBy,omitempty"`
// The internal ID for this version (will be replaced with resourceVersion)
Version int `json:"version"`
// If the dashboard came from a previous version, it is set here
ParentVersion int `json:"parentVersion,omitempty"`
// The creation timestamp for this version
Created int64 `json:"created"`
// The user who created this version
CreatedBy string `json:"createdBy,omitempty"`
// Message passed while saving the version
Message string `json:"message,omitempty"`
}
// +k8s:conversion-gen:explicit-from=net/url.Values
@@ -233,7 +233,7 @@ func (in *DashboardVersionInfo) DeepCopy() *DashboardVersionInfo {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DashboardVersionsInfo) DeepCopyInto(out *DashboardVersionsInfo) {
func (in *DashboardVersionList) DeepCopyInto(out *DashboardVersionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
@@ -245,18 +245,18 @@ func (in *DashboardVersionsInfo) DeepCopyInto(out *DashboardVersionsInfo) {
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DashboardVersionsInfo.
func (in *DashboardVersionsInfo) DeepCopy() *DashboardVersionsInfo {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DashboardVersionList.
func (in *DashboardVersionList) DeepCopy() *DashboardVersionList {
if in == nil {
return nil
}
out := new(DashboardVersionsInfo)
out := new(DashboardVersionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *DashboardVersionsInfo) DeepCopyObject() runtime.Object {
func (in *DashboardVersionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@@ -16,17 +16,17 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.AnnotationActions": schema_pkg_apis_dashboard_v0alpha1_AnnotationActions(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.AnnotationPermission": schema_pkg_apis_dashboard_v0alpha1_AnnotationPermission(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.Dashboard": schema_pkg_apis_dashboard_v0alpha1_Dashboard(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardAccessInfo": schema_pkg_apis_dashboard_v0alpha1_DashboardAccessInfo(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardList": schema_pkg_apis_dashboard_v0alpha1_DashboardList(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummary": schema_pkg_apis_dashboard_v0alpha1_DashboardSummary(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummaryList": schema_pkg_apis_dashboard_v0alpha1_DashboardSummaryList(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummarySpec": schema_pkg_apis_dashboard_v0alpha1_DashboardSummarySpec(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardVersionInfo": schema_pkg_apis_dashboard_v0alpha1_DashboardVersionInfo(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardVersionsInfo": schema_pkg_apis_dashboard_v0alpha1_DashboardVersionsInfo(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.VersionsQueryOptions": schema_pkg_apis_dashboard_v0alpha1_VersionsQueryOptions(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.AnnotationActions": schema_pkg_apis_dashboard_v0alpha1_AnnotationActions(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.AnnotationPermission": schema_pkg_apis_dashboard_v0alpha1_AnnotationPermission(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.Dashboard": schema_pkg_apis_dashboard_v0alpha1_Dashboard(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardAccessInfo": schema_pkg_apis_dashboard_v0alpha1_DashboardAccessInfo(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardList": schema_pkg_apis_dashboard_v0alpha1_DashboardList(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummary": schema_pkg_apis_dashboard_v0alpha1_DashboardSummary(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummaryList": schema_pkg_apis_dashboard_v0alpha1_DashboardSummaryList(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardSummarySpec": schema_pkg_apis_dashboard_v0alpha1_DashboardSummarySpec(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardVersionInfo": schema_pkg_apis_dashboard_v0alpha1_DashboardVersionInfo(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.DashboardVersionList": schema_pkg_apis_dashboard_v0alpha1_DashboardVersionList(ref),
"github.com/grafana/grafana/pkg/apis/dashboard/v0alpha1.VersionsQueryOptions": schema_pkg_apis_dashboard_v0alpha1_VersionsQueryOptions(ref),
}
}
@@ -380,34 +380,39 @@ func schema_pkg_apis_dashboard_v0alpha1_DashboardVersionInfo(ref common.Referenc
Properties: map[string]spec.Schema{
"version": {
SchemaProps: spec.SchemaProps{
Default: 0,
Type: []string{"integer"},
Format: "int32",
Description: "The internal ID for this version (will be replaced with resourceVersion)",
Default: 0,
Type: []string{"integer"},
Format: "int32",
},
},
"parentVersion": {
SchemaProps: spec.SchemaProps{
Type: []string{"integer"},
Format: "int32",
Description: "If the dashboard came from a previous version, it is set here",
Type: []string{"integer"},
Format: "int32",
},
},
"created": {
SchemaProps: spec.SchemaProps{
Default: 0,
Type: []string{"integer"},
Format: "int64",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
Description: "The creation timestamp for this version",
Default: 0,
Type: []string{"integer"},
Format: "int64",
},
},
"createdBy": {
SchemaProps: spec.SchemaProps{
Type: []string{"string"},
Format: "",
Description: "The user who created this version",
Type: []string{"string"},
Format: "",
},
},
"message": {
SchemaProps: spec.SchemaProps{
Description: "Message passed while saving the version",
Type: []string{"string"},
Format: "",
},
},
},
@@ -417,7 +422,7 @@ func schema_pkg_apis_dashboard_v0alpha1_DashboardVersionInfo(ref common.Referenc
}
}
func schema_pkg_apis_dashboard_v0alpha1_DashboardVersionsInfo(ref common.ReferenceCallback) common.OpenAPIDefinition {
func schema_pkg_apis_dashboard_v0alpha1_DashboardVersionList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{