@@ -20,6 +20,10 @@ use openapiv3::{Components, Parameter, ReferenceOr, RequestBody, Response, Schem
20
20
21
21
use crate :: utils:: SchemaName ;
22
22
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
+
23
27
pub struct TypesAndComponents < ' a > {
24
28
pub model : & ' a clients_schema:: IndexedModel ,
25
29
pub components : & ' a mut Components ,
@@ -43,14 +47,14 @@ impl<'a> TypesAndComponents<'a> {
43
47
let suffix = if duplicate { "_" } else { "" } ;
44
48
let result = ReferenceOr :: Reference {
45
49
reference : format ! (
46
- "#/components/parameters/{}# {}{}" ,
50
+ "#/components/parameters/{}{SEPARATOR} {}{}" ,
47
51
endpoint,
48
52
& param. parameter_data_ref( ) . name,
49
53
suffix
50
54
) ,
51
55
} ;
52
56
self . components . parameters . insert (
53
- format ! ( "{}# {}{}" , endpoint, & param. parameter_data_ref( ) . name, suffix) ,
57
+ format ! ( "{}{SEPARATOR} {}{}" , endpoint, & param. parameter_data_ref( ) . name, suffix) ,
54
58
ReferenceOr :: Item ( param) ,
55
59
) ;
56
60
result
@@ -59,9 +63,9 @@ impl<'a> TypesAndComponents<'a> {
59
63
pub fn add_response ( & mut self , endpoint : & str , status : StatusCode , response : Response ) -> ReferenceOr < Response > {
60
64
self . components
61
65
. responses
62
- . insert ( format ! ( "{}# {}" , endpoint, status) , ReferenceOr :: Item ( response) ) ;
66
+ . insert ( format ! ( "{}{SEPARATOR} {}" , endpoint, status) , ReferenceOr :: Item ( response) ) ;
63
67
ReferenceOr :: Reference {
64
- reference : format ! ( "#/components/responses/{}# {}" , endpoint, status) ,
68
+ reference : format ! ( "#/components/responses/{}{SEPARATOR} {}" , endpoint, status) ,
65
69
}
66
70
}
67
71
0 commit comments