Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports parameter directly commented. #952

Merged
merged 2 commits into from
Jul 11, 2024
Merged

Conversation

samchon
Copy link
Owner

@samchon samchon commented Jul 10, 2024

From now on, @nestia/sdk supports parameter directly commented.

Also, it can compose OpenApi.IOperation.IParameter.title from description comment.

export class ParamController {
  /**
   * Composite path parameters.
   * 
   * @param value The first value.
   *              The first string value.
   * @param value2 The second value.
   *               The second string value.
   * @returns Concatenated string.
   */
  @core.TypedRoute.Get(":value/composite/:value2")
  public composite(
    @core.TypedParam("value") value: string,
    @core.TypedParam("value2") value2: string,
  ): string {
    return value + value2;
  }

  /**
   * The number.
   */
  @core.TypedRoute.Get(":value/number")
  public number(
    /**
    * Description in the parameter.
    */
    @core.TypedParam("value") 
    value: number
  ): number {
    return value;
  }

  /**
   * The string.
   */
  @core.TypedRoute.Get(":value/string")
  public string(
    /**
     * @title Yaho
     * @description Yoohoo
     */
    @core.TypedParam("value") value: string
  ): string {
    return value;
  }
}
    "/param/{value}/composite/{value2}": {
      "get": {
        "tags": [],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "title": "The first value",
            "description": " The first value.\r\nThe first string value."
          },
          {
            "name": "value2",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "title": "The second value",
            "description": " The second value.\r\nThe second string value."
          }
        ],
        "responses": {
          "200": {
            "description": "Concatenated string.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Composite path parameters",
        "description": "Composite path parameters."
      }
    },
    "/param/{value}/string": {
      "get": {
        "tags": [],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "schema": {
              "type": "string"
            },
            "title": "Yaho",
            "description": "Yoohoo"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "The string",
        "description": "The string."
      }
    },
    "/param/{value}/nullable": {
      "get": {
        "tags": [],
        "parameters": [
          {
            "name": "value",
            "in": "path",
            "schema": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "type": "string"
                }
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "type": "string"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }

@samchon samchon added the enhancement New feature or request label Jul 10, 2024
@samchon samchon self-assigned this Jul 10, 2024
@samchon samchon merged commit 8440b05 into master Jul 11, 2024
6 checks passed
@samchon samchon deleted the features/param-title branch July 11, 2024 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant