@@ -59,6 +59,24 @@ import {
5959
6060const jsonSpec = buildJsonSpec ( )
6161
62+ export function reAddAvailability ( model : model . Model ) : model . Model {
63+ for ( const [ api , spec ] of jsonSpec . entries ( ) ) {
64+ for ( const endpoint of model . endpoints ) {
65+ if ( endpoint . name === api ) {
66+ if ( ( spec . stability != null || spec . visibility != null ) && ( endpoint . availability . stack === undefined && endpoint . availability . serverless === undefined ) ) {
67+ endpoint . availability = {
68+ stack : {
69+ stability : spec . stability ,
70+ visibility : spec . visibility
71+ }
72+ }
73+ }
74+ }
75+ }
76+ }
77+ return model
78+ }
79+
6280export function compileEndpoints ( ) : Record < string , model . Endpoint > {
6381 // Create endpoints and merge them with
6482 // the recorded mappings if present.
@@ -73,12 +91,7 @@ export function compileEndpoints (): Record<string, model.Endpoint> {
7391 // Setting these values by default should be removed
7492 // when we no longer use rest-api-spec stubs as the
7593 // source of truth for stability/visibility.
76- availability : {
77- stack : {
78- stability : spec . stability ,
79- visibility : spec . visibility
80- }
81- } ,
94+ availability : { } ,
8295 request : null ,
8396 requestBodyRequired : Boolean ( spec . body ?. required ) ,
8497 response : null ,
@@ -91,7 +104,7 @@ export function compileEndpoints (): Record<string, model.Endpoint> {
91104 } )
92105 }
93106 if ( typeof spec . feature_flag === 'string' ) {
94- map [ api ] . availability . stack . featureFlag = spec . feature_flag
107+ map [ api ] . availability . stack = { featureFlag : spec . feature_flag }
95108 }
96109 }
97110 return map
0 commit comments