Skip to content

Parser (v3) doesn't handle "enum" when "format" demands decoding a string #1049

@kerrykimbrough

Description

@kerrykimbrough

See attached example. Consider the schema for param0, which has type=string and format=date-time.

Because of this format, an instance of DateTimeSchema is created. Then to handle the "enum" array, OpenAPIDeserializer.getSchema() iterates over each TextNode in the array, calling DateTimeSchema.addEnumItemObject() with the corresponding String value. This invokes DateTimeSchema.cast(), which should decode the String as an RFC3339 date-time.

But it doesn't. Instead, since a String is not a Date, it just substitutes null. Yikes!

The same problem occurs with other string formats that required decoding, specifically "byte" and "date".

string-8.json.txt

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