@@ -156,26 +156,27 @@ class Component {
156
156
const version = manifest . spec . version ;
157
157
const name = manifest . spec . names . plural ;
158
158
const spec = { paths : { } } ;
159
+ const namespace = manifest . spec . scope === 'Cluster' ? '' : '/namespaces/{namespace}' ;
159
160
160
161
//
161
162
// Make just enough of Swagger spec to generate some useful endpoints.
162
163
//
163
- const templatePath = `/apis/${ group } /${ version } /namespaces/{ namespace}/${ name } /{name}` ;
164
+ const templatePath = `/apis/${ group } /${ version } ${ namespace } /${ name } /{name}` ;
164
165
spec . paths [ templatePath ] = [ 'delete' , 'get' , 'patch' , 'put' ] . reduce ( ( acc , method ) => {
165
166
acc [ method ] = { operationId : `${ method } Template${ name } ` } ;
166
167
return acc ;
167
168
} , { } ) ;
168
169
169
- const path = `/apis/${ group } /${ version } /namespaces/{ namespace}/${ name } ` ;
170
+ const path = `/apis/${ group } /${ version } ${ namespace } /${ name } ` ;
170
171
spec . paths [ path ] = [ 'get' , 'post' ] . reduce ( ( acc , method ) => {
171
172
acc [ method ] = { operationId : `${ method } ${ name } ` } ;
172
173
return acc ;
173
174
} , { } ) ;
174
175
175
176
const watchPaths = {
176
177
watchCluster : `/apis/${ group } /${ version } /watch/${ name } ` ,
177
- watchNamespace : `/apis/${ group } /${ version } /namespaces/{ namespace}/watch/${ name } ` ,
178
- watchResource : `/apis/${ group } /${ version } /namespaces/{ namespace}/watch/${ name } /{name}`
178
+ watchNamespace : `/apis/${ group } /${ version } ${ namespace } /watch/${ name } ` ,
179
+ watchResource : `/apis/${ group } /${ version } ${ namespace } /watch/${ name } /{name}`
179
180
} ;
180
181
Object . keys ( watchPaths ) . forEach ( operationId => {
181
182
const watchPath = watchPaths [ operationId ] ;
0 commit comments