Skip to content

Commit 093bd05

Browse files
committed
fix: add OpenAPIModelName for all types referenced in OpenAPI schemas
1 parent 884ff95 commit 093bd05

File tree

2 files changed

+187
-0
lines changed

2 files changed

+187
-0
lines changed

pkg/lib/version/model_name.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright Red Hat, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package version
18+
19+
// OpenAPIModelName returns the OpenAPI model name for this type.
20+
// This ensures the OpenAPI schema uses the canonical name format (com.github...)
21+
// instead of the URL-encoded Go import path format that causes lookup failures.
22+
func (OperatorVersion) OpenAPIModelName() string {
23+
return "com.github.operator-framework.api.pkg.lib.version.OperatorVersion"
24+
}
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
/*
2+
Copyright Red Hat, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
// OpenAPIModelName methods for all types that are referenced in OpenAPI schemas.
20+
// This ensures the OpenAPI schema uses the canonical name format (com.github...)
21+
// instead of the URL-encoded Go import path format that causes lookup failures.
22+
//
23+
// When Kubernetes serves OpenAPI schemas, "/" in type references gets URL-encoded
24+
// to "~1". If the schema definition keys don't match, lookups fail with errors like:
25+
// unknown model in reference: "github.com~1operator-framework~1api~1..."
26+
//
27+
// Adding OpenAPIModelName() makes openapi-gen use the canonical format for both
28+
// the definition key and references, ensuring they match.
29+
30+
// OpenAPIModelName returns the OpenAPI model name for this type.
31+
func (APIResourceReference) OpenAPIModelName() string {
32+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.APIResourceReference"
33+
}
34+
35+
// OpenAPIModelName returns the OpenAPI model name for this type.
36+
func (APIServiceDefinitions) OpenAPIModelName() string {
37+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.APIServiceDefinitions"
38+
}
39+
40+
// OpenAPIModelName returns the OpenAPI model name for this type.
41+
func (APIServiceDescription) OpenAPIModelName() string {
42+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.APIServiceDescription"
43+
}
44+
45+
// OpenAPIModelName returns the OpenAPI model name for this type.
46+
func (ActionDescriptor) OpenAPIModelName() string {
47+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ActionDescriptor"
48+
}
49+
50+
// OpenAPIModelName returns the OpenAPI model name for this type.
51+
func (AppLink) OpenAPIModelName() string {
52+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.AppLink"
53+
}
54+
55+
// OpenAPIModelName returns the OpenAPI model name for this type.
56+
func (CRDDescription) OpenAPIModelName() string {
57+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.CRDDescription"
58+
}
59+
60+
// OpenAPIModelName returns the OpenAPI model name for this type.
61+
func (CleanupSpec) OpenAPIModelName() string {
62+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.CleanupSpec"
63+
}
64+
65+
// OpenAPIModelName returns the OpenAPI model name for this type.
66+
func (CleanupStatus) OpenAPIModelName() string {
67+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.CleanupStatus"
68+
}
69+
70+
// OpenAPIModelName returns the OpenAPI model name for this type.
71+
func (ClusterServiceVersionCondition) OpenAPIModelName() string {
72+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ClusterServiceVersionCondition"
73+
}
74+
75+
// OpenAPIModelName returns the OpenAPI model name for this type.
76+
func (ClusterServiceVersionSpec) OpenAPIModelName() string {
77+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ClusterServiceVersionSpec"
78+
}
79+
80+
// OpenAPIModelName returns the OpenAPI model name for this type.
81+
func (ClusterServiceVersionStatus) OpenAPIModelName() string {
82+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ClusterServiceVersionStatus"
83+
}
84+
85+
// OpenAPIModelName returns the OpenAPI model name for this type.
86+
func (CustomResourceDefinitions) OpenAPIModelName() string {
87+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.CustomResourceDefinitions"
88+
}
89+
90+
// OpenAPIModelName returns the OpenAPI model name for this type.
91+
func (DependentStatus) OpenAPIModelName() string {
92+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.DependentStatus"
93+
}
94+
95+
// OpenAPIModelName returns the OpenAPI model name for this type.
96+
func (Icon) OpenAPIModelName() string {
97+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.Icon"
98+
}
99+
100+
// OpenAPIModelName returns the OpenAPI model name for this type.
101+
func (InstallMode) OpenAPIModelName() string {
102+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.InstallMode"
103+
}
104+
105+
// OpenAPIModelName returns the OpenAPI model name for this type.
106+
func (Maintainer) OpenAPIModelName() string {
107+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.Maintainer"
108+
}
109+
110+
// OpenAPIModelName returns the OpenAPI model name for this type.
111+
func (NamedInstallStrategy) OpenAPIModelName() string {
112+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.NamedInstallStrategy"
113+
}
114+
115+
// OpenAPIModelName returns the OpenAPI model name for this type.
116+
func (RelatedImage) OpenAPIModelName() string {
117+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.RelatedImage"
118+
}
119+
120+
// OpenAPIModelName returns the OpenAPI model name for this type.
121+
func (RequirementStatus) OpenAPIModelName() string {
122+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.RequirementStatus"
123+
}
124+
125+
// OpenAPIModelName returns the OpenAPI model name for this type.
126+
func (ResourceInstance) OpenAPIModelName() string {
127+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ResourceInstance"
128+
}
129+
130+
// OpenAPIModelName returns the OpenAPI model name for this type.
131+
func (ResourceList) OpenAPIModelName() string {
132+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.ResourceList"
133+
}
134+
135+
// OpenAPIModelName returns the OpenAPI model name for this type.
136+
func (SpecDescriptor) OpenAPIModelName() string {
137+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.SpecDescriptor"
138+
}
139+
140+
// OpenAPIModelName returns the OpenAPI model name for this type.
141+
func (StatusDescriptor) OpenAPIModelName() string {
142+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.StatusDescriptor"
143+
}
144+
145+
// OpenAPIModelName returns the OpenAPI model name for this type.
146+
func (StrategyDeploymentPermissions) OpenAPIModelName() string {
147+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.StrategyDeploymentPermissions"
148+
}
149+
150+
// OpenAPIModelName returns the OpenAPI model name for this type.
151+
func (StrategyDeploymentSpec) OpenAPIModelName() string {
152+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.StrategyDeploymentSpec"
153+
}
154+
155+
// OpenAPIModelName returns the OpenAPI model name for this type.
156+
func (StrategyDetailsDeployment) OpenAPIModelName() string {
157+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.StrategyDetailsDeployment"
158+
}
159+
160+
// OpenAPIModelName returns the OpenAPI model name for this type.
161+
func (WebhookDescription) OpenAPIModelName() string {
162+
return "com.github.operator-framework.api.pkg.operators.v1alpha1.WebhookDescription"
163+
}

0 commit comments

Comments
 (0)