Skip to content

Array where items are nullable strings fails validation with OpenapiFirst::ResponseInvalidError #427

@nfm

Description

@nfm

I have an API response where the property value is an array of strings, with null values allowed:

# Example API response:
{ "path": ["1", "2", null] }

With this partial schema, I'm seeing the above API response fail validation:

path:
  type: array
  items:
    type: string
    # The last item can be null to signify the participant 'passed'
    nullable: true

With this error:

OpenapiFirst::ResponseInvalidError in MyController#some_action

Response body is invalid: value at `/path/2` is not a string.

I also tried this:

path:
  type: array
  items:
    oneOf:
      - type: string
    nullable: true

Hopefully that makes sense, please let me know if a reproduction repro would be helpful of if this is enough context 🙏 Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions