samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.77k stars 91 forks source link

Supports parameter directly commented. #952

Closed samchon closed 1 month ago

samchon commented 1 month ago

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"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
socket-security[bot] commented 1 month ago

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@nestia/benchmark@0.1.0 None 0 0 B
npm/@nestjs/platform-fastify@10.3.10 Transitive: environment, eval, filesystem, unsafe +55 11.8 MB nestjscore
npm/@types/cli-progress@3.11.6 None 0 13.1 kB types
npm/@types/swagger-ui-express@4.1.6 None +4 34.6 kB types
npm/cli-progress@3.12.0 None 0 62.2 kB andidittrich
npm/commander@10.0.0 environment, filesystem, shell 0 174 kB shadowspawn
npm/dotenv-expand@10.0.0 None 0 13.9 kB motdotla
npm/dotenv@16.4.5 environment, filesystem 0 79.1 kB motdotla
npm/inquirer@8.2.5 None 0 87.6 kB sboudrias
npm/rimraf@5.0.9 environment, filesystem +3 1.49 MB isaacs
npm/rimraf@6.0.1 environment, filesystem Transitive: shell +18 3.28 MB isaacs
npm/serialize-error@4.1.0 None +1 27.6 kB sindresorhus
npm/source-map-support@0.5.21 filesystem +1 890 kB linusu
npm/swagger-ui-express@5.0.1 None +1 11.3 MB scottie1984

🚮 Removed packages: npm/@fastify/multipart@8.3.0, npm/@types/glob@7.2.0, npm/@types/multer@1.4.11, npm/@types/ws@8.5.10, npm/eslint-plugin-deprecation@1.6.0, npm/fastify@4.28.1, npm/git-last-commit@1.0.1, npm/ts-expose-internals@5.4.5

View full report↗︎