Skip to content

Conversation

@prasanthcisco
Copy link
Collaborator

Problem

The description-for-every-attribute rule in the completeness analyzer was incorrectly requiring a description field on requestBody objects. According to the OpenAPI Specification, requestBody.description is optional:

"requestBody consists of the content object, an optional Markdown-formatted description, and an optional required flag."
This caused unnecessary errors for valid OpenAPI specs where the operation description already provides sufficient context, making the requestBody description redundant.

Solution

Removed '$.paths...requestBody' from the given array in the description-for-every-attribute rule in completeness.js.

Testing

Added new test suite test/completeness-description-for-every-attribute.spec.js with 4 test cases:

  • requestBody without description should NOT trigger an error
  • Parameters without description should still trigger an error
  • Responses without description should still trigger an error
  • Spec with all required descriptions should pass
    All 138 test suites pass (552 tests total).

…lyzer

The requestBody.description field is optional per OpenAPI spec. Removed
'$.paths.*.*.requestBody' from description-for-every-attribute rule in
completeness.js. Added tests to verify the fix.
Copy link

@esyriac esyriac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make sure that removing requestBody from the criteria is not breaking any other required functionality. please do a thorough testing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants