@@ -23,6 +23,7 @@ use clients_schema::{Privileges, Property};
2323use indexmap:: IndexMap ;
2424use indexmap:: indexmap;
2525use icu_segmenter:: SentenceSegmenter ;
26+ use itertools:: Itertools ;
2627use openapiv3:: {
2728 MediaType , Parameter , ParameterData , ParameterSchemaOrContent , PathItem , PathStyle , Paths , QueryStyle , ReferenceOr ,
2829 RequestBody , Response , Responses , StatusCode , Example
@@ -293,6 +294,8 @@ pub fn add_endpoint(
293294 if !code_samples. is_empty ( ) {
294295 extensions. insert ( "x-codeSamples" . to_string ( ) , serde_json:: json!( code_samples) ) ;
295296 }
297+ let mut ext_availability = crate :: availability_as_extensions ( & endpoint. availability ) ;
298+ extensions. append ( & mut ext_availability) ;
296299
297300 // Create the operation, it will be repeated if we have several methods
298301 let operation = openapiv3:: Operation {
@@ -317,7 +320,7 @@ pub fn add_endpoint(
317320 deprecated : endpoint. deprecation . is_some ( ) ,
318321 security : None ,
319322 servers : vec ! [ ] ,
320- extensions : crate :: availability_as_extensions ( & endpoint . availability ) ,
323+ extensions
321324 } ;
322325
323326
@@ -449,15 +452,17 @@ fn split_summary_desc(desc: &str) -> SplitDesc{
449452fn add_privileges ( privileges : & Option < Privileges > ) -> Option < String > {
450453 if let Some ( privs) = privileges {
451454 let mut result = "\n ##Required authorization\n " . to_string ( ) ;
452- if privs. index . len ( ) >0 {
453- result = result + "* Index privileges: " + & privs. index . iter ( )
454- . map ( |a| { "`" . to_string ( ) + a + "`" } )
455- . collect :: < Vec < String > > ( ) . join ( "," ) ;
455+ if !privs. index . is_empty ( ) {
456+ result += "* Index privileges: " ;
457+ result += & privs. index . iter ( )
458+ . map ( |a| format ! ( "`{a}`" ) )
459+ . join ( "," ) ;
456460 }
457- if privs. cluster . len ( ) >0 {
458- result = result + " * Cluster privileges: " + & privs. cluster . iter ( )
459- . map ( |a| { "`" . to_string ( ) + a + "`" } )
460- . collect :: < Vec < String > > ( ) . join ( "," ) ;
461+ if !privs. cluster . is_empty ( ) {
462+ result += "* Cluster privileges: " ;
463+ result += & privs. cluster . iter ( )
464+ . map ( |a| format ! ( "`{a}`" ) )
465+ . join ( "," ) ;
461466 }
462467 return Some ( result)
463468 }
0 commit comments