JsonParseException while using multi line base64 encoded value with type string

Issue #206 new
Sai Srikar Mutya created an issue

Hello there,

While using a base64 encoded value which can have multiple lines, Swagger is throwing a JsonParseException as it is not escaping characters correctly and putting into a JSON to validate against the schema.

Comments (5)

  1. Sven Döring

    JSON can't have multiline strings. Not even as Base64 encoded byte array. Therefore the JsonParseException is right - your JSON is invalid.

    See http://json.org/ for more information on the String definition. A new line has to be escaped with \n.

  2. Sai Srikar Mutya reporter

    @Sven Doring

    I understand that a json cannot have multi line values. But I am talking about a string value which is Base64 encoded which can be a multi line.

    My requirement is simple, I want to have query parameter which is Base64 encoded value (Base64 encoded value can have newline characters). This is something swagger is not allowing.

    Is there an alternative to this??

  3. Sven Döring

    There is an issue on GitHub for Jackson addressing multiline Base64 strings. https://github.com/FasterXML/jackson-core/issues/414

    Some sort of fix was released with version 2.9.4.

    Which version is used by the OpenAPI validator? I vaguely remember something about version 2.8.x.

    Can you try it with a newer 2.9.x version?

    Edit:

    Since version 1.4.0 of the Swagger Request Validator it uses Jackson 2.9.5.

    So, right now, the used JSON decoder does not support multiline Base64 strings.

  4. Log in to comment