@@ -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 // add the x-state extension for availability
255262 let mut extensions = crate :: availability_as_extensions ( & endpoint. availability ) ;
@@ -295,7 +302,7 @@ pub fn add_endpoint(
295302 vec ! [ namespace. to_string( ) ]
296303 } ,
297304 summary : sum_desc. summary ,
298- description : sum_desc . description ,
305+ description : full_desc ,
299306 external_docs : tac. convert_external_docs ( endpoint) ,
300307 // external_docs: None, // Need values that differ from client purposes
301308 operation_id : None , // set in clone_operation below with operation_counter
@@ -310,7 +317,7 @@ pub fn add_endpoint(
310317 deprecated : endpoint. deprecation . is_some ( ) ,
311318 security : None ,
312319 servers : vec ! [ ] ,
313- extensions : crate :: extensions ( & endpoint. availability , & endpoint . privileges ) ,
320+ extensions : crate :: extensions ( & endpoint. availability ) ,
314321 } ;
315322
316323
@@ -439,6 +446,20 @@ fn split_summary_desc(desc: &str) -> SplitDesc{
439446 }
440447}
441448
449+ fn add_privileges ( privileges : & Option < Privileges > ) -> Option < String > {
450+ if let Some ( privs) = privileges {
451+ let mut result = "Required privileges:" . to_string ( ) ;
452+ if privs. index . len ( ) >0 {
453+ result = result + " index-privileges: " + & privs. index . join ( "," ) ;
454+ }
455+ if privs. cluster . len ( ) >0 {
456+ result = result + " cluster-privileges: " + & privs. cluster . join ( "," ) ;
457+ }
458+ return Some ( result)
459+ }
460+ None
461+ }
462+
442463#[ derive( PartialEq , Debug ) ]
443464struct SplitDesc {
444465 summary : Option < String > ,
0 commit comments