
io.vertx.openapi.contract.RequestBody Maven / Gradle / Ivy
/*
* Copyright (c) 2023, SAP SE
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
* which is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
*
*/
package io.vertx.openapi.contract;
import io.vertx.codegen.annotations.VertxGen;
import java.util.Map;
/**
* This interface represents the most important attributes of an OpenAPI Operation.
*
* Operation V3.1
*
* Operation V3.0
*/
@VertxGen
public interface RequestBody extends OpenAPIObject {
/**
* @return true if the request body is required in the request, otherwise false.
*/
boolean isRequired();
/**
* @return a map containing descriptions of potential request payloads. The key is a media type or media
* type range and the value describes it.
*/
Map getContent();
/**
* This method tries to determine the best fitting {@link 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.
*
* @return A fitting media type, or null.
*/
MediaType determineContentType(String mediaTypeIdentifier);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy