@@ -11,29 +11,29 @@ use walkdir::WalkDir;
1111#[ derive( Args , Debug ) ]
1212pub struct ToOpenApiArgs {
1313 /// Path to the code directory or file to parse.
14- #[ clap( short = 'f ' , long, env = "CDD_FILE " ) ]
15- pub file : PathBuf ,
14+ #[ clap( short = 'i ' , long, env = "CDD_INPUT " ) ]
15+ pub input : PathBuf ,
1616
1717 /// Output file for the generated OpenAPI spec.
1818 #[ clap( short = 'o' , long, env = "CDD_OUTPUT" , default_value = "spec.json" ) ]
1919 pub output : PathBuf ,
2020}
2121
2222pub fn execute ( args : & ToOpenApiArgs , target : & TargetMode ) -> AppResult < ( ) > {
23- println ! ( "Extracting OpenAPI specification from {:?}" , args. file ) ;
23+ println ! ( "Extracting OpenAPI specification from {:?}" , args. input ) ;
2424
25- if !args. file . exists ( ) {
25+ if !args. input . exists ( ) {
2626 return Err ( AppError :: General ( format ! (
2727 "Path not found: {:?}" ,
28- args. file
28+ args. input
2929 ) ) ) ;
3030 }
3131
3232 let mut parsed_models = Vec :: new ( ) ;
3333 let mut parsed_routes = Vec :: new ( ) ;
3434
3535 // Walk directory and parse models and routes
36- let walker = WalkDir :: new ( & args. file ) . into_iter ( ) ;
36+ let walker = WalkDir :: new ( & args. input ) . into_iter ( ) ;
3737 for entry in walker. filter_map ( |e| e. ok ( ) ) {
3838 let path = entry. path ( ) ;
3939 if path. extension ( ) . is_some_and ( |ext| ext == "rs" ) {
@@ -120,7 +120,7 @@ mod tests {
120120 . unwrap ( ) ;
121121
122122 let args = ToOpenApiArgs {
123- file : src_dir,
123+ input : src_dir,
124124 output : dir. path ( ) . join ( "spec.json" ) ,
125125 } ;
126126
@@ -131,7 +131,7 @@ mod tests {
131131 #[ test]
132132 fn test_to_openapi_file_not_found ( ) {
133133 let args = ToOpenApiArgs {
134- file : PathBuf :: from ( "does_not_exist_dir" ) ,
134+ input : PathBuf :: from ( "does_not_exist_dir" ) ,
135135 output : PathBuf :: from ( "spec.json" ) ,
136136 } ;
137137 let result = execute ( & args, & TargetMode :: Server ) ;
@@ -158,7 +158,7 @@ mod tests {
158158 . unwrap ( ) ;
159159
160160 let args = ToOpenApiArgs {
161- file : src_dir. clone ( ) ,
161+ input : src_dir. clone ( ) ,
162162 output : dir. path ( ) . join ( "spec.json" ) ,
163163 } ;
164164
@@ -187,7 +187,7 @@ mod tests {
187187 std:: fs:: write ( & input_file, handler_code) . unwrap ( ) ;
188188
189189 let args = ToOpenApiArgs {
190- file : input_file,
190+ input : input_file,
191191 output : output_file. clone ( ) ,
192192 } ;
193193
@@ -212,7 +212,7 @@ mod tests {
212212 std:: fs:: write ( & input_file, handler_code) . unwrap ( ) ;
213213
214214 let args = ToOpenApiArgs {
215- file : input_file,
215+ input : input_file,
216216 output : std:: path:: PathBuf :: from ( "/nonexistent_dir/output.yaml" ) ,
217217 } ;
218218
0 commit comments