Skip to content

Commit ebd4ff8

Browse files
committed
Add description to operation, generate Rust method docs
1 parent fd7dbc4 commit ebd4ff8

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/api.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ struct Operation {
140140
id: String,
141141
/// The name to use for the operation in code.
142142
name: String,
143+
/// Description of the operation to use for documentation.
144+
#[serde(skip_serializing_if = "Option::is_none")]
145+
description: Option<String>,
143146
/// The HTTP method.
144147
///
145148
/// Encoded as "get", "post" or such because that's what aide's PathItem iterator gives us.
@@ -316,6 +319,7 @@ impl Operation {
316319
let op = Operation {
317320
id: op_id,
318321
name: op_name,
322+
description: op.description,
319323
method: method.to_owned(),
320324
path: path.to_owned(),
321325
path_params,

templates/svix_resource.rs.jinja

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ impl<'a> {{ resource_type_name }}<'a> {
4949
{% for op in resource.operations %}
5050
{% set has_query_params = op.query_params | length > 0 -%}
5151
{% set has_header_params = op.header_params | length > 0 -%}
52+
{% if op.description is defined -%}
53+
#[doc = " {{ op.description }}"]
54+
{% endif -%}
5255
pub async fn {{ op.name | to_snake_case }}(
5356
&self,
5457

0 commit comments

Comments
 (0)