io.muserver.openapi.RequestBodyObjectBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mu-server Show documentation
Show all versions of mu-server Show documentation
A simple but powerful web server framework
package io.muserver.openapi;
import java.util.Map;
/**
* Describes a single request body.
*/
public class RequestBodyObjectBuilder {
private String description;
private Map content;
private boolean required;
/**
* @param description A brief description of the request body. This could contain examples of use.
* CommonMark syntax MAY be used for rich text representation.
* @return The current builder
*/
public RequestBodyObjectBuilder withDescription(String description) {
this.description = description;
return this;
}
/**
* @param content REQUIRED. The content of the request body. The key is a media type or
* media type range and the value describes it.
* For requests that match multiple keys, only the most specific key is applicable. e.g. text/plain overrides text/*
* @return The current builder
*/
public RequestBodyObjectBuilder withContent(Map content) {
this.content = content;
return this;
}
/**
* @param required Determines if the request body is required in the request. Defaults to false
.
* @return The current builder
*/
public RequestBodyObjectBuilder withRequired(boolean required) {
this.required = required;
return this;
}
public RequestBodyObject build() {
return new RequestBodyObject(description, content, required);
}
/**
* Creates a builder for a {@link RequestBodyObject}
*
* @return A new builder
*/
public static RequestBodyObjectBuilder requestBodyObject() {
return new RequestBodyObjectBuilder();
}
}