@@ -103,7 +103,7 @@ pub fn convert_expanded_schema(model: &IndexedModel, config: &Configuration) ->
103103 continue ;
104104 }
105105 }
106- paths:: add_endpoint ( endpoint, & mut tac, & mut openapi. paths ) ?;
106+ paths:: add_endpoint ( endpoint, & mut tac, & mut openapi. paths , & config . flavor ) ?;
107107 }
108108
109109 // // Sort maps to ensure output stability
@@ -149,34 +149,33 @@ fn info(model: &IndexedModel) -> openapiv3::Info {
149149 }
150150}
151151
152- pub fn availability_as_extensions ( availabilities : & Option < Availabilities > ) -> IndexMap < String , serde_json:: Value > {
152+ pub fn availability_as_extensions ( availabilities : & Option < Availabilities > , flavor : & Option < Flavor > ) -> IndexMap < String , serde_json:: Value > {
153153 let mut result = IndexMap :: new ( ) ;
154-
155154 if let Some ( avails) = availabilities {
156- // We may have several availabilities, but since generally exists only on stateful (stack)
157- for ( _, availability) in avails {
158- if let Some ( stability) = & availability. stability {
159- let mut since_str = "" . to_string ( ) ;
160- if let Some ( since) = & availability. since {
161- since_str = "; Added in " . to_string ( ) + since;
162- }
163- match stability {
164- Stability :: Beta => {
165- let beta_since = "Beta" . to_string ( ) + & since_str;
166- result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( beta_since) ) ;
155+ if let Some ( flavor) = flavor {
156+ if let Some ( availability) = avails. get ( flavor) {
157+ if let Some ( stability) = & availability. stability {
158+ let mut since_str = "" . to_string ( ) ;
159+ if let Some ( since) = & availability. since {
160+ since_str = "; Added in " . to_string ( ) + since;
167161 }
168- Stability :: Experimental => {
169- let exp_since = "Technical preview" . to_string ( ) + & since_str;
170- result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( exp_since) ) ;
171- }
172- Stability :: Stable => {
173- let stable_since = "Generally available" . to_string ( ) + & since_str;
174- result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( stable_since) ) ;
162+ match stability {
163+ Stability :: Beta => {
164+ let beta_since = "Beta" . to_string ( ) + & since_str;
165+ result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( beta_since) ) ;
166+ }
167+ Stability :: Experimental => {
168+ let exp_since = "Technical preview" . to_string ( ) + & since_str;
169+ result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( exp_since) ) ;
170+ }
171+ Stability :: Stable => {
172+ let stable_since = "Generally available" . to_string ( ) + & since_str;
173+ result. insert ( "x-state" . to_string ( ) , serde_json:: Value :: String ( stable_since) ) ;
174+ }
175175 }
176176 }
177177 }
178178 }
179179 }
180-
181180 result
182181}
0 commit comments