swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Validate empty Swagger property names

Open king-407 opened this issue 5 months ago • 0 comments

Fixes #2339.

What changed

This adds validation for Swagger 2.0 schemas that contain an empty property name under properties.

Previously, a schema like this was parsed without reporting a validation message:

"properties": {
  "AA": { "type": "string" },
  "": { "type": "number" }
}

The converter now adds a validation message for the empty property name while continuing to parse the document.

Testing

Ran the focused regression test and the full V2ConverterTest class:

mvn -pl modules/swagger-parser-v2-converter -am -Dtest=V2ConverterTest#testEmptyPropertyNameHasMessage -Dsurefire.failIfNoSpecifiedTests=false test
mvn -pl modules/swagger-parser-v2-converter -am -Dtest=V2ConverterTest -Dsurefire.failIfNoSpecifiedTests=false test

king-407 avatar Jun 09 '26 15:06 king-407