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 {
10031003pub struct ModelInfo {
10041004 pub title : String ,
10051005 pub license : License ,
1006- pub version : Option < String > ,
10071006}
10081007
10091008#[ derive( Debug , Clone , Serialize , Deserialize ) ]
Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ pub struct Cli {
2424 #[ argh( option) ]
2525 pub namespace : Vec < String > ,
2626
27+ /// the branch to generate [9.0, 8.19, current, etc... - default = current]
28+ #[ argh( option) ]
29+ pub branch : Option < String > ,
30+
2731 /// add enum descriptions to property descriptions [default = true]
2832 #[ argh( switch) ]
2933 pub lift_enum_descriptions : bool ,
@@ -72,9 +76,12 @@ impl From<Cli> for Configuration {
7276 SchemaFlavor :: Serverless => Some ( Flavor :: Serverless ) ,
7377 SchemaFlavor :: Stack => Some ( Flavor :: Stack ) ,
7478 } ;
79+
80+ let branch = cli. branch ;
7581
7682 Configuration {
7783 flavor,
84+ branch,
7885 lift_enum_descriptions : cli. lift_enum_descriptions ,
7986 merge_multipath_endpoints : cli. merge_multipath_endpoints ,
8087 multipath_redirects : cli. multipath_redirects ,
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ use crate::components::TypesAndComponents;
3232pub struct Configuration {
3333 pub flavor : Option < Flavor > ,
3434 pub namespaces : Option < Vec < String > > ,
35+ pub branch : Option < String > ,
3536
3637 /// If a property value is an enumeration, the description of possible values will be copied in the
3738 /// 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> {
209209 pub fn convert_external_docs ( & self , obj : & impl clients_schema:: ExternalDocument ) -> Option < ExternalDocumentation > {
210210 // FIXME: does the model contain resolved doc_id?
211211 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 ( ) ;
218213 let mut extensions: IndexMap < String , serde_json:: Value > = Default :: default ( ) ;
219214 if let Some ( previous_version_doc_url) = obj. ext_previous_version_doc_url ( ) {
220215 extensions. insert ( "x-previousVersionUrl" . to_string ( ) , serde_json:: json!( previous_version_doc_url) ) ;
221216 }
222217 ExternalDocumentation {
223218 description : None ,
224- url : url. trim ( ) . replace ( "{branch}" , branch) ,
219+ url : url. trim ( ) . replace ( "{branch}" , & branch. unwrap_or ( "current" . to_string ( ) ) ) ,
225220 extensions,
226221 }
227222 } )
You can’t perform that action at this time.
0 commit comments