@@ -19,7 +19,7 @@ use std::collections::HashMap;
1919use std:: fmt:: Write ;
2020
2121use anyhow:: { anyhow, bail} ;
22- use clients_schema:: Property ;
22+ use clients_schema:: { Privileges , Property } ;
2323use indexmap:: IndexMap ;
2424use indexmap:: indexmap;
2525use icu_segmenter:: SentenceSegmenter ;
@@ -250,6 +250,13 @@ pub fn add_endpoint(
250250 parameters. append ( & mut query_params. clone ( ) ) ;
251251
252252 let sum_desc = split_summary_desc ( & endpoint. description ) ;
253+
254+ let privilege_desc = add_privileges ( & endpoint. privileges ) ;
255+
256+ let full_desc = match ( sum_desc. description , privilege_desc) {
257+ ( Some ( a) , Some ( b) ) => Some ( a+ & b) ,
258+ ( opt_a, opt_b) => opt_a. or ( opt_b)
259+ } ;
253260
254261 // Create the operation, it will be repeated if we have several methods
255262 let operation = openapiv3:: Operation {
@@ -259,7 +266,7 @@ pub fn add_endpoint(
259266 vec ! [ namespace. to_string( ) ]
260267 } ,
261268 summary : sum_desc. summary ,
262- description : sum_desc . description ,
269+ description : full_desc ,
263270 external_docs : tac. convert_external_docs ( endpoint) ,
264271 // external_docs: None, // Need values that differ from client purposes
265272 operation_id : None , // set in clone_operation below with operation_counter
@@ -274,7 +281,7 @@ pub fn add_endpoint(
274281 deprecated : endpoint. deprecation . is_some ( ) ,
275282 security : None ,
276283 servers : vec ! [ ] ,
277- extensions : crate :: extensions ( & endpoint. availability , & endpoint . privileges ) ,
284+ extensions : crate :: extensions ( & endpoint. availability ) ,
278285 } ;
279286
280287
@@ -403,6 +410,20 @@ fn split_summary_desc(desc: &str) -> SplitDesc{
403410 }
404411}
405412
413+ fn add_privileges ( privileges : & Option < Privileges > ) -> Option < String > {
414+ if let Some ( privs) = privileges {
415+ let mut result = "Required privileges:" . to_string ( ) ;
416+ if privs. index . len ( ) >0 {
417+ result = result + " index-privileges: " + & privs. index . join ( "," ) ;
418+ }
419+ if privs. cluster . len ( ) >0 {
420+ result = result + " cluster-privileges: " + & privs. cluster . join ( "," ) ;
421+ }
422+ return Some ( result)
423+ }
424+ None
425+ }
426+
406427#[ derive( PartialEq , Debug ) ]
407428struct SplitDesc {
408429 summary : Option < String > ,
0 commit comments