OpenAPI "Any Value" is incorrectly validated as an object

Issue #400 new
Polak Piotr created an issue

According to https://swagger.io/docs/specification/data-models/data-types/#any , a field accepting any data can be described as:

components:
  schemas:
    AnyValue: {}

When validating primitive values against such definition Swagger Request Validator throws error indicating that it expects an object:

A payload example

{
  "anyValue": "a valid string value matching #/components/schemas/AnyValue"
}

Results in an error "key" : "validation.response.body.schema.type", "level" : "ERROR", "message" : "[Path '/anyValue'] Instance type (string) does not match any allowed primitive type (allowed: [\"object\"])",

Comments (2)

  1. Log in to comment