@@ -20,6 +20,10 @@ use openapiv3::{Components, Parameter, ReferenceOr, RequestBody, Response, Schem
2020
2121use crate :: utils:: SchemaName ;
2222
23+ // Separator used to combine parts of a component path.
24+ // See https://github.com/elastic/elasticsearch-specification/issues/4183
25+ pub const SEPARATOR : char = ':' ;
26+
2327pub struct TypesAndComponents < ' a > {
2428 pub model : & ' a clients_schema:: IndexedModel ,
2529 pub components : & ' a mut Components ,
@@ -43,14 +47,14 @@ impl<'a> TypesAndComponents<'a> {
4347 let suffix = if duplicate { "_" } else { "" } ;
4448 let result = ReferenceOr :: Reference {
4549 reference : format ! (
46- "#/components/parameters/{}# {}{}" ,
50+ "#/components/parameters/{}{SEPARATOR} {}{}" ,
4751 endpoint,
4852 & param. parameter_data_ref( ) . name,
4953 suffix
5054 ) ,
5155 } ;
5256 self . components . parameters . insert (
53- format ! ( "{}# {}{}" , endpoint, & param. parameter_data_ref( ) . name, suffix) ,
57+ format ! ( "{}{SEPARATOR} {}{}" , endpoint, & param. parameter_data_ref( ) . name, suffix) ,
5458 ReferenceOr :: Item ( param) ,
5559 ) ;
5660 result
@@ -59,9 +63,9 @@ impl<'a> TypesAndComponents<'a> {
5963 pub fn add_response ( & mut self , endpoint : & str , status : StatusCode , response : Response ) -> ReferenceOr < Response > {
6064 self . components
6165 . responses
62- . insert ( format ! ( "{}# {}" , endpoint, status) , ReferenceOr :: Item ( response) ) ;
66+ . insert ( format ! ( "{}{SEPARATOR} {}" , endpoint, status) , ReferenceOr :: Item ( response) ) ;
6367 ReferenceOr :: Reference {
64- reference : format ! ( "#/components/responses/{}# {}" , endpoint, status) ,
68+ reference : format ! ( "#/components/responses/{}{SEPARATOR} {}" , endpoint, status) ,
6569 }
6670 }
6771
0 commit comments