Skip to content

Commit 62dc7c0

Browse files
authored
Add documentation for macros list properties (#183)
2 parents cdd3f3c + 694671c commit 62dc7c0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

apistos-gen/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ pub fn derive_api_component(input: TokenStream) -> TokenStream {
182182
/// - `bearer_format = "..."` a **required** parameter
183183
/// - `open_id_connect(open_id_connect_url = "...")`
184184
///
185+
/// _To define multiple elements of a list, repeat the property multiple times_
186+
///
185187
/// # Examples:
186188
///
187189
/// ## **oauth2**
@@ -411,6 +413,8 @@ pub fn derive_api_cookie(input: TokenStream) -> TokenStream {
411413
/// - `status(...)` a list of possible error status with
412414
/// - `code = 000` a **required** http status code
413415
/// - `description = "..."` an optional description, default is the canonical reason of the given status code
416+
///
417+
/// _To define multiple elements of a list, repeat the property multiple times_
414418
#[proc_macro_error]
415419
#[proc_macro_derive(ApiErrorComponent, attributes(openapi_error))]
416420
pub fn derive_api_error(input: TokenStream) -> TokenStream {
@@ -458,9 +462,13 @@ pub fn derive_api_error(input: TokenStream) -> TokenStream {
458462
/// #[derive(Serialize, Deserialize, Debug, Clone, ApiErrorComponent)]
459463
/// #[openapi_error(
460464
/// status(code = 405, description = "Invalid input"),
465+
/// status(code = 401),
466+
/// status(code = 403),
461467
/// )]
462468
/// pub enum ErrorResponse {
463469
/// MethodNotAllowed(String),
470+
/// Unauthorized(String),
471+
/// Forbidden(String),
464472
/// }
465473
///
466474
/// impl Display for ErrorResponse {
@@ -480,6 +488,7 @@ pub fn derive_api_error(input: TokenStream) -> TokenStream {
480488
/// summary = "Add a new pet to the store",
481489
/// description = r###"Add a new pet to the store
482490
/// Plop"###,
491+
/// error_code = 401,
483492
/// error_code = 405
484493
/// )]
485494
/// pub(crate) async fn test(
@@ -507,6 +516,8 @@ pub fn derive_api_error(input: TokenStream) -> TokenStream {
507516
/// - `consumes = "..."` allow to override body content type
508517
/// - `produces = "..."` allow to override response content type
509518
///
519+
/// _To define multiple elements of a list, repeat the property multiple times_
520+
///
510521
/// If `summary` or `description` are not provided, a default value will be extracted from the comments. The first line will be used as summary while the rest will be part of the description.
511522
///
512523
/// For example:

0 commit comments

Comments
 (0)