@@ -59,11 +59,20 @@ def _new_generator_command(ctx, declared_dir, rjars):
5959 gen_cmd += ' --type-mappings "{mappings}"' .format (
6060 mappings = _comma_separated_pairs (ctx .attr .type_mappings ),
6161 )
62-
62+
6363 gen_cmd += ' --reserved-words-mappings "{reserved_words_mappings}"' .format (
6464 reserved_words_mappings = "," .join (ctx .attr .reserved_words_mappings ),
6565 )
6666
67+ if ctx .attr .config :
68+ gen_cmd += " --config {config}" .format (
69+ config = ctx .attr .config .files .to_list ()[0 ].path ,
70+ )
71+ if ctx .attr .template_dir :
72+ gen_cmd += " --template-dir {template_dir}" .format (
73+ template_dir = ctx .attr .template_dir .files .to_list ()[0 ].path ,
74+ )
75+
6776 if ctx .attr .api_package :
6877 gen_cmd += " --api-package {package}" .format (
6978 package = ctx .attr .api_package ,
@@ -97,6 +106,12 @@ def _impl(ctx):
97106 ctx .file .spec ,
98107 ] + cjars .to_list () + rjars .to_list ()
99108
109+ if ctx .attr .config :
110+ inputs += ctx .attr .config .files .to_list ()
111+
112+ if ctx .attr .template_dir :
113+ inputs += ctx .attr .template_dir .files .to_list ()
114+
100115 # TODO: Convert to run
101116 ctx .actions .run_shell (
102117 inputs = inputs ,
@@ -157,6 +172,8 @@ _openapi_generator = rule(
157172 ".yml" ,
158173 ],
159174 ),
175+ "template_dir" : attr .label (allow_single_file = True ),
176+ "config" : attr .label (allow_single_file = True ),
160177 "generator" : attr .string (mandatory = True ),
161178 "api_package" : attr .string (),
162179 "invoker_package" : attr .string (),
0 commit comments