Skip to content

panic: interface conversion: interface {} is float64, not string #207

@negbie

Description

@negbie

Because of the for loop following code line is error prone and caused a panic on one of my files:
https://github.com/deepmap/oapi-codegen/blob/master/pkg/codegen/schema.go#L258

I would suggest to check if the type assertions was successful like:

for i, enumValue := range schema.Enum {
    if s, ok := enumValue.(string); ok {
        enumValues[i] = s
    }
}

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