@@ -39,17 +39,15 @@ enum Command {
39
39
input_file : String ,
40
40
41
41
/// Path to the output directory.
42
- #[ clap( long) ]
42
+ #[ clap( short , long) ]
43
43
output_dir : Option < Utf8PathBuf > ,
44
44
45
45
#[ clap( flatten) ]
46
46
flags : GenerateFlags ,
47
47
48
- /// The specified operations for --include-mode=specified
49
- ///
50
- /// This expects the operation ID, for example v1.message.create
51
- #[ clap( long) ]
52
- specified_operations : Vec < String > ,
48
+ /// The codegen will ignore any operations in this list
49
+ #[ clap( short, long) ]
50
+ excluded_operations : Vec < String > ,
53
51
} ,
54
52
}
55
53
@@ -78,8 +76,6 @@ enum IncludeMode {
78
76
PublicAndHidden ,
79
77
/// Only operations marked with `x-hidden`
80
78
OnlyHidden ,
81
- /// Only include operations specified in `--specified-operations`
82
- Specified ,
83
79
}
84
80
85
81
fn main ( ) -> anyhow:: Result < ( ) > {
@@ -91,17 +87,17 @@ fn main() -> anyhow::Result<()> {
91
87
input_file,
92
88
output_dir,
93
89
flags,
94
- specified_operations ,
90
+ excluded_operations ,
95
91
} = args. command ;
96
- let specified_operations = BTreeSet :: from_iter ( specified_operations ) ;
92
+ let excluded_operations = BTreeSet :: from_iter ( excluded_operations ) ;
97
93
98
94
let spec = fs:: read_to_string ( & input_file) ?;
99
95
100
96
let spec: OpenApi = serde_json:: from_str ( & spec) . context ( "failed to parse OpenAPI spec" ) ?;
101
97
102
98
match & output_dir {
103
99
Some ( path) => {
104
- analyze_and_generate ( spec, template. into ( ) , path, flags, specified_operations ) ?;
100
+ analyze_and_generate ( spec, template. into ( ) , path, flags, excluded_operations ) ?;
105
101
}
106
102
None => {
107
103
let output_dir_root = PathBuf :: from ( "out" ) ;
@@ -123,7 +119,7 @@ fn main() -> anyhow::Result<()> {
123
119
. path ( )
124
120
. try_into ( )
125
121
. context ( "non-UTF8 tempdir path" ) ?;
126
- analyze_and_generate ( spec, template. into ( ) , path, flags, specified_operations ) ?;
122
+ analyze_and_generate ( spec, template. into ( ) , path, flags, excluded_operations ) ?;
127
123
// Persist the TempDir if everything was successful
128
124
_ = output_dir. into_path ( ) ;
129
125
}
@@ -137,7 +133,7 @@ fn analyze_and_generate(
137
133
template : String ,
138
134
path : & Utf8Path ,
139
135
flags : GenerateFlags ,
140
- specified_operations : BTreeSet < String > ,
136
+ excluded_operations : BTreeSet < String > ,
141
137
) -> anyhow:: Result < ( ) > {
142
138
let webhooks = get_webhooks ( & spec) ;
143
139
let mut components = spec. components . unwrap_or_default ( ) ;
@@ -146,7 +142,7 @@ fn analyze_and_generate(
146
142
paths,
147
143
& components. schemas ,
148
144
flags. include_mode ,
149
- specified_operations ,
145
+ excluded_operations ,
150
146
)
151
147
. unwrap ( ) ;
152
148
let types = api. types ( & mut components. schemas , webhooks) ;
0 commit comments