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;
}

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 most cases, the name is equivalent to the parameter variable name. Therefore, the name must be filled with the significant variable name of the parameter.

Note: 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 analysis.

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 always be true when the in property is path. Otherwise, the required property can be any of these values: true, false, or undefined.

Type info of the parameter.