File tree Expand file tree Collapse file tree 4 files changed +8
-10
lines changed
clients_schema_to_openapi/src Expand file tree Collapse file tree 4 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -1003,6 +1003,7 @@ pub struct UrlTemplate {
10031003pub struct ModelInfo {
10041004 pub title : String ,
10051005 pub license : License ,
1006+ pub version : Option < String > ,
10061007}
10071008
10081009#[ derive( Debug , Clone , Serialize , Deserialize ) ]
Original file line number Diff line number Diff line change @@ -24,10 +24,6 @@ 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-
3127 /// add enum descriptions to property descriptions [default = true]
3228 #[ argh( switch) ]
3329 pub lift_enum_descriptions : bool ,
@@ -76,12 +72,9 @@ impl From<Cli> for Configuration {
7672 SchemaFlavor :: Serverless => Some ( Flavor :: Serverless ) ,
7773 SchemaFlavor :: Stack => Some ( Flavor :: Stack ) ,
7874 } ;
79-
80- let branch = cli. branch ;
8175
8276 Configuration {
8377 flavor,
84- branch,
8578 lift_enum_descriptions : cli. lift_enum_descriptions ,
8679 merge_multipath_endpoints : cli. merge_multipath_endpoints ,
8780 multipath_redirects : cli. multipath_redirects ,
Original file line number Diff line number Diff line change @@ -32,7 +32,6 @@ use crate::components::TypesAndComponents;
3232pub struct Configuration {
3333 pub flavor : Option < Flavor > ,
3434 pub namespaces : Option < Vec < String > > ,
35- pub branch : Option < String > ,
3635
3736 /// If a property value is an enumeration, the description of possible values will be copied in the
3837 /// property's description (also works for arrays of enums).
Original file line number Diff line number Diff line change @@ -209,14 +209,19 @@ 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 = self . config . branch . clone ( ) ;
212+ let branch: & str = self
213+ . model
214+ . info
215+ . as_ref ( )
216+ . and_then ( |i| i. version . as_deref ( ) )
217+ . unwrap_or ( "current" ) ;
213218 let mut extensions: IndexMap < String , serde_json:: Value > = Default :: default ( ) ;
214219 if let Some ( previous_version_doc_url) = obj. ext_previous_version_doc_url ( ) {
215220 extensions. insert ( "x-previousVersionUrl" . to_string ( ) , serde_json:: json!( previous_version_doc_url) ) ;
216221 }
217222 ExternalDocumentation {
218223 description : None ,
219- url : url. trim ( ) . replace ( "{branch}" , & branch. unwrap_or ( "current" . to_string ( ) ) ) ,
224+ url : url. trim ( ) . replace ( "{branch}" , branch) ,
220225 extensions,
221226 }
222227 } )
You can’t perform that action at this time.
0 commit comments