swagger-api / swagger-api/validator-badge

validation failing when describing request body for post request using "style" and "explode" serialization strategy

Open
#177 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
227
Forks
81
Avg merge
2h 3m
Merged PRs (30d)
1

Description

When describing the request body for a post request using "style" and "explode" as serialization strategy for primitive types rather than defining "contentType" (used for more complex serialization strategies), the validation is failing.

Relative documentation is https://swagger.io/docs/specification/describing-request-body/ in the "Form Data" and "Complex Serialization in Form Data" sections.

The API I'm trying to validate is here: https://raw.githubusercontent.com/BibleGet-I-O/endpoint/master/openapi.json

I have defined it using swaggerhub, where it shows as being valid: https://app.swaggerhub.com/apis/JohnRDOrazio/BibleGet/2.8

If instead I try validating with the badge validator: https://validator.swagger.io/validator/debug?url=https://raw.githubusercontent.com/BibleGet-I-O/endpoint/master/openapi.json

I get these errors:

{"messages":["attribute paths.'/index.php'(post).requestBody.content.encoding.contentType is missing","attribute paths.'/metadata.php'(post).requestBody.content.encoding.contentType is missing"],"schemaValidationMessages":[{"level":"warning","domain":"validation","keyword":"format","message":"format attribute \"uri-reference\" not supported","schema":{"loadingURI":"#","pointer":"/definitions/Contact/properties/url"}},{"level":"warning","domain":"validation","keyword":"format","message":"format attribute \"uri-reference\" not supported","schema":{"loadingURI":"#","pointer":"/definitions/License/properties/url"}},{"level":"warning","domain":"validation","keyword":"format","message":"format attribute \"uri-reference\" not supported","schema":{"loadingURI":"#","pointer":"/definitions/Info/properties/termsOfService"}}]}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the supplied endpoint OpenAPI JSON and the validator debug URL, focusing on the requestBody encoding entries for the POST paths. Compare the validator's requirement for contentType with the OpenAPI form-data documentation and SwaggerHub result; done means the valid style/explode serialization no longer produces missing-contentType errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.