Skip to content

NullPointerException with Empty items Field in OpenAPI SpecΒ #165

@erblsqa

Description

@erblsqa

I'm running contract tests using CATS and encountered an issue when array definitions in the OpenAPI specification have an empty items field or are missing it entirely. This causes a NullPointerException and crashes the test process.

For example, this field in the OpenAPI spec:

"QueryRestarted": {
  "example": [],
  "items": {},
  "maxItems": 0,
  "type": "array"
}

The items field is present but empty, which leads to the error. The empty items field should be considered valid according to OpenAPI, but it causes the tests to fail unexpectedly with CATS.

Steps to Reproduce:

  1. Define an array in the OpenAPI specification with an empty items field or a missing items field.
  2. Run the contract tests using CATS.
  3. Observe the NullPointerException error.

Expected Behavior:
CATS should be able to handle an empty or missing items field without crashing. The spec itself should be considered valid.

Actual Behavior:
CATS throws a NullPointerException, which results in the test process crashing.

Suggested Action:
We would appreciate it if you could investigate the issue with the empty items field causing a NullPointerException and suggest any workarounds or fixes for handling this scenario in CATS.

Thank you!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions