File tree Expand file tree Collapse file tree 2 files changed +13
-16
lines changed
src/platform/packages/shared/kbn-router-to-openapispec/src Expand file tree Collapse file tree 2 files changed +13
-16
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,11 @@ describe('setXState', () => {
387
387
availability : undefined ,
388
388
expected : undefined ,
389
389
} ,
390
+ {
391
+ name : 'only since' ,
392
+ availability : { since : '8.0.0' } ,
393
+ expected : 'Added in 8.0.0' ,
394
+ } ,
390
395
] ) ( '$name' , ( { availability, expected } ) => {
391
396
// Create a minimal valid CustomOperationObject with required responses property
392
397
const operation : CustomOperationObject = {
Original file line number Diff line number Diff line change @@ -186,26 +186,18 @@ export const setXState = (
186
186
operation : CustomOperationObject
187
187
) : void => {
188
188
if ( availability ) {
189
+ let state = '' ;
189
190
if ( availability . stability === 'stable' ) {
190
- if ( availability . since ) {
191
- operation [ 'x-state' ] = `Generally available; added in ${ availability . since } ` ;
192
- } else {
193
- // since is mandatory for stable, but handle the case if it's missing
194
- operation [ 'x-state' ] = 'Generally available' ;
195
- }
191
+ state = 'Generally available' ;
196
192
} else if ( availability . stability === 'experimental' ) {
197
- if ( availability . since ) {
198
- operation [ 'x-state' ] = `Technical Preview; added in ${ availability . since } ` ;
199
- } else {
200
- operation [ 'x-state' ] = 'Technical Preview' ;
201
- }
193
+ state = 'Technical Preview' ;
202
194
} else if ( availability . stability === 'beta' ) {
203
- if ( availability . since ) {
204
- operation [ 'x-state' ] = `Beta; added in ${ availability . since } ` ;
205
- } else {
206
- operation [ 'x-state' ] = 'Beta' ;
207
- }
195
+ state = 'Beta' ;
196
+ }
197
+ if ( availability . since ) {
198
+ state = state ? `${ state } ; added in ${ availability . since } ` : `Added in ${ availability . since } ` ;
208
199
}
200
+ operation [ 'x-state' ] = state ;
209
201
}
210
202
} ;
211
203
You can’t perform that action at this time.
0 commit comments