Skip to main content

required-2XX-response-content-for-get-operation

Overview

This rule belongs to the openapi-v3-apimatic-linting ruleset and states that:

GET operations are generally expected to return some form of data for a successful call. Therefore, for GET operations, a response definition with a status code belonging to the 2XX range (except 204) should have a non-empty content mapping defined using the content property.

PropertyValue
EnabledNo
Maximum SeverityWarning
MessageThe 2XX response in the GET operation has a missing or empty content definition.
CodeOPENAPI3APIMATIC_L464
TypeLinting
Rule SystemSemantic
Broad CategoryOpenAPI Responses
Products ImpactedAPI Transformer, Code Generation, Developer Experience Portal
Tagsopenapi3 openapi apimatic semantic linting content response get operation

Suggested Fixes

  • If your GET operation is expected to return some data in the response body, ensure that the response definition has a content mapping defined using the content property.
  • If content is defined, ensure that the map is not empty and contains at least one entry.
  • If your GET operation is not expected to have a response body, you should ignore this lint check or disable it.

For More Information