Interface RequestBody

All Superinterfaces:
OpenAPIObject

public interface RequestBody extends OpenAPIObject
This interface represents the most important attributes of an OpenAPI Operation.
Operation V3.1
Operation V3.0
  • Method Details

    • isRequired

      boolean isRequired()
      Returns:
      true if the request body is required in the request, otherwise false.
    • getContent

      Map<String, MediaType> getContent()
      Returns:
      a map containing descriptions of potential request payloads. The key is a media type or media type range and the value describes it.
    • determineContentType

      MediaType determineContentType(String mediaTypeIdentifier)
      This method tries to determine the best fitting MediaType based on the passed content type.

      This is necessary, to avoid that an incoming request of type application/json; charset=utf-8 is failing, because we only declared application/json in the OpenAPI spec.

      Important: If application/json is declared in the contract, application/json; charset=utf-8 would fit, but not the other way around.
      Returns:
      A fitting media type, or null.