All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.muserver.openapi.LinkObjectBuilder Maven / Gradle / Ivy

There is a newer version: 2.0.3
Show newest version
package io.muserver.openapi;

import java.util.Map;

/**
 * 

The Link object represents a possible design-time link for a response. The presence of a link does not * guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism * between responses and other operations.

*

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism * does not require link information in the runtime response.

*

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in * an operation and using them as parameters while invoking the linked operation.

*/ public class LinkObjectBuilder { private String operationId; private Map parameters; private Object requestBody; private String description; private ServerObject server; /** * @param operationId The name of an existing, resolvable OAS operation, as defined with a unique operationId. * @return The current builder */ public LinkObjectBuilder withOperationId(String operationId) { this.operationId = operationId; return this; } /** * @param parameters A map representing parameters to pass to an operation as specified with operationId. * The key is the parameter name to be used, whereas the value can be a constant or an expression to be * evaluated and passed to the linked operation. The parameter name can be qualified using the parameter * location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id). * @return The current builder */ public LinkObjectBuilder withParameters(Map parameters) { this.parameters = parameters; return this; } /** * @param requestBody A literal value or {expression} to use as a request body when calling the target operation. * @return The current builder */ public LinkObjectBuilder withRequestBody(Object requestBody) { this.requestBody = requestBody; return this; } /** * @param description A description of the link. CommonMark syntax MAY be * used for rich text representation. * @return The current builder */ public LinkObjectBuilder withDescription(String description) { this.description = description; return this; } /** * @param server A server object to be used by the target operation. * @return The current builder */ public LinkObjectBuilder withServer(ServerObject server) { this.server = server; return this; } public LinkObject build() { return new LinkObject(operationId, parameters, requestBody, description, server); } /** * Creates a builder for a {@link LinkObject} * * @return A new builder */ public static LinkObjectBuilder linkObject() { return new LinkObjectBuilder(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy