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