Skip to content

Code does not check for nil values #1062

@yuoppp

Description

@yuoppp

openapi spec:

/1/values/:
  get:
    operationId: getValues
    parameters:
      -  in: query
         name: lang
         schema:
           type: string
         enum:
           - fr
           - en
         default: en

generates the following code:

func NewGetValuesRequestWithBody(server string, params *GetValuesParams, contentType string, body io.Reader) (*http.Request, error) {
    ...
    
    if params.Lang != nil {
    }
}

which causes panic invalid memory address or nil pointer dereference

it should be checked for nil

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions