File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed
clients_schema_to_openapi/src Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -1003,7 +1003,6 @@ pub struct UrlTemplate {
1003
1003
pub struct ModelInfo {
1004
1004
pub title : String ,
1005
1005
pub license : License ,
1006
- pub version : Option < String > ,
1007
1006
}
1008
1007
1009
1008
#[ derive( Debug , Clone , Serialize , Deserialize ) ]
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ pub struct Cli {
24
24
#[ argh( option) ]
25
25
pub namespace : Vec < String > ,
26
26
27
+ /// the branch to generate [9.0, 8.19, current, etc... - default = current]
28
+ #[ argh( option) ]
29
+ pub branch : Option < String > ,
30
+
27
31
/// add enum descriptions to property descriptions [default = true]
28
32
#[ argh( switch) ]
29
33
pub lift_enum_descriptions : bool ,
@@ -72,9 +76,12 @@ impl From<Cli> for Configuration {
72
76
SchemaFlavor :: Serverless => Some ( Flavor :: Serverless ) ,
73
77
SchemaFlavor :: Stack => Some ( Flavor :: Stack ) ,
74
78
} ;
79
+
80
+ let branch = cli. branch ;
75
81
76
82
Configuration {
77
83
flavor,
84
+ branch,
78
85
lift_enum_descriptions : cli. lift_enum_descriptions ,
79
86
merge_multipath_endpoints : cli. merge_multipath_endpoints ,
80
87
multipath_redirects : cli. multipath_redirects ,
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ use crate::components::TypesAndComponents;
32
32
pub struct Configuration {
33
33
pub flavor : Option < Flavor > ,
34
34
pub namespaces : Option < Vec < String > > ,
35
+ pub branch : Option < String > ,
35
36
36
37
/// If a property value is an enumeration, the description of possible values will be copied in the
37
38
/// property's description (also works for arrays of enums).
Original file line number Diff line number Diff line change @@ -209,19 +209,14 @@ impl<'a> TypesAndComponents<'a> {
209
209
pub fn convert_external_docs ( & self , obj : & impl clients_schema:: ExternalDocument ) -> Option < ExternalDocumentation > {
210
210
// FIXME: does the model contain resolved doc_id?
211
211
obj. ext_doc_url ( ) . map ( |url| {
212
- let branch: & str = self
213
- . model
214
- . info
215
- . as_ref ( )
216
- . and_then ( |i| i. version . as_deref ( ) )
217
- . unwrap_or ( "current" ) ;
212
+ let branch = self . config . branch . clone ( ) ;
218
213
let mut extensions: IndexMap < String , serde_json:: Value > = Default :: default ( ) ;
219
214
if let Some ( previous_version_doc_url) = obj. ext_previous_version_doc_url ( ) {
220
215
extensions. insert ( "x-previousVersionUrl" . to_string ( ) , serde_json:: json!( previous_version_doc_url) ) ;
221
216
}
222
217
ExternalDocumentation {
223
218
description : None ,
224
- url : url. trim ( ) . replace ( "{branch}" , branch) ,
219
+ url : url. trim ( ) . replace ( "{branch}" , & branch. unwrap_or ( "current" . to_string ( ) ) ) ,
225
220
extensions,
226
221
}
227
222
} )
You can’t perform that action at this time.
0 commit comments