@@ -20,9 +20,8 @@ enum TemplateKind {
20
20
#[ default]
21
21
ApiResource ,
22
22
OperationOptions ,
23
- ApiSummary ,
24
23
Type ,
25
- TypeSummary ,
24
+ Summary ,
26
25
}
27
26
28
27
pub ( crate ) fn generate (
@@ -46,12 +45,11 @@ pub(crate) fn generate(
46
45
let tpl_kind = match tpl_base_name {
47
46
"api_resource" => TemplateKind :: ApiResource ,
48
47
"operation_options" => TemplateKind :: OperationOptions ,
49
- "api_summary" => TemplateKind :: ApiSummary ,
48
+ "api_summary" | "component_type_summary" | "summary" => TemplateKind :: Summary ,
50
49
"component_type" => TemplateKind :: Type ,
51
- "component_type_summary" => TemplateKind :: TypeSummary ,
52
50
_ => bail ! (
53
51
"template file basename must be one of 'api_resource', 'api_summary', \
54
- 'component_type', 'component_type_summary'",
52
+ 'component_type', 'component_type_summary', 'summary' ",
55
53
) ,
56
54
} ;
57
55
@@ -78,9 +76,8 @@ pub(crate) fn generate(
78
76
match tpl_kind {
79
77
TemplateKind :: OperationOptions => generator. generate_api_resources_options ( api) ?,
80
78
TemplateKind :: ApiResource => generator. generate_api_resources ( api) ?,
81
- TemplateKind :: ApiSummary => generator. generate_api_summary ( api) ?,
82
79
TemplateKind :: Type => generator. generate_types ( types) ?,
83
- TemplateKind :: TypeSummary => generator. generate_type_summary ( types) ?,
80
+ TemplateKind :: Summary => generator. generate_summary ( types, api ) ?,
84
81
}
85
82
86
83
if !no_postprocess {
@@ -155,12 +152,8 @@ impl Generator<'_> {
155
152
Ok ( ( ) )
156
153
}
157
154
158
- fn generate_api_summary ( & self , api : Api ) -> anyhow:: Result < ( ) > {
159
- self . render_tpl ( None , context ! { api } )
160
- }
161
-
162
- fn generate_type_summary ( & self , Types ( types) : Types ) -> anyhow:: Result < ( ) > {
163
- self . render_tpl ( None , context ! { types } )
155
+ fn generate_summary ( & self , Types ( types) : Types , api : Api ) -> anyhow:: Result < ( ) > {
156
+ self . render_tpl ( None , context ! { types, api } )
164
157
}
165
158
166
159
fn render_tpl ( & self , output_name : Option < & str > , ctx : minijinja:: Value ) -> anyhow:: Result < ( ) > {
0 commit comments