Skip to content

Empty schema object leads to ClassCastException #58

@david0

Description

@david0

when the schema object is empty, a ClassCastException will be logged:

    post:
      summary: Create a pet
      operationId: createPets
      requestBody:
        description: Pet to add to the store
        required: true
        content:
          application/json:
            schema: {}
      tags:
        - pets
java.lang.ClassCastException: class com.fasterxml.jackson.databind.node.MissingNode cannot be cast to class com.fasterxml.jackson.databind.node.ObjectNode (com.fasterxml.jackson.databind.node.MissingNode and com.fasterxml.jackson.databind.node.ObjectNode are in unnamed module of loader 'app')
	at com.mservicetech.openapi.validation.SchemaValidator.doValidate(SchemaValidator.java:124)
	at com.mservicetech.openapi.validation.SchemaValidator.doValidate(SchemaValidator.java:112)
	at com.mservicetech.openapi.validation.SchemaValidator.validate(SchemaValidator.java:87)
	at com.mservicetech.openapi.validation.OpenApiValidator.validateRequestBody(OpenApiValidator.java:214)
	at com.mservicetech.openapi.validation.OpenApiValidator.validateRequestPath(OpenApiValidator.java:176)
	at com.mservicetech.openapi.validation.OpenApiValidatorTest.testRequestBody(OpenApiValidatorTest.java:58)

What I would have expected, is that it behaves like type: object as I expected that to be the implied default, but I cannot find anything about that in the standards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions