Parameter of the operation.

interface IParameter {
    description?: string;
    example?: any;
    examples?: Record<string, OpenApi.IExample>;
    in: "path" | "query" | "header" | "cookie";
    name?: string;
    required?: boolean;
    schema: OpenApi.IJsonSchema;
    title?: string;
}

Properties

description?: string

Verbose explanation of the parameter.

example?: any

Example value of the parameter.

examples?: Record<string, OpenApi.IExample>

Collection of example values of the parameter with keys.

in: "path" | "query" | "header" | "cookie"

Location of the parameter.

The in property is a string that determines the location of the parameter.

  • path: parameter is part of the path of the URL.
  • query: parameter is part of the query string.
  • header: parameter is part of the header.
  • cookie: parameter is part of the cookie.
name?: string

Representative name of the parameter.

In the most case, the name is equivalent to parameter variable name. Therefore, the name must be filled with the significant variable name of the parameter.

By the way, only when the in property is path, the name can be omitted. In that case, the name is automatically deduced from the URL path's positional template argument analyzing.

required?: boolean

Whether the parameter is required for execution or not.

If the parameter is required, the value must be filled. Otherwise, it is possible to skip the parameter when executing the APi operation.

For reference, the required property must be always true when the in property is path. Otherwise, the required property can be anything of them; true, false and undefined.

Type info of the parameter.

title?: string

Short title of the parameter.