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

org.apache.juneau.dto.swagger.ResponseInfo Maven / Gradle / Ivy

There is a newer version: 9.0.1
Show newest version
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
// * with the License.  You may obtain a copy of the License at                                                              *
// *                                                                                                                         *
// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
// *                                                                                                                         *
// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
// * specific language governing permissions and limitations under the License.                                              *
// ***************************************************************************************************************************
package org.apache.juneau.dto.swagger;

import java.util.*;

import org.apache.juneau.annotation.*;

/**
 * Describes a single response from an API Operation.
 *
 * 
Example:
*

* { * "description": "A complex object array response", * "schema": { * "type": "array", * "items": { * "$ref": "#/definitions/VeryComplexType" * } * } * } *

* *
Additional Information
* */ @Bean(properties="description,schema,headers,examples") public class ResponseInfo extends SwaggerElement { private String description; private SchemaInfo schema; private Map headers; private Map examples; /** * Bean property getter: description. * *

* Required. A short description of the response. * *

* GFM syntax can be used for * rich text representation. * * @return The value of the description property on this bean, or null if it is not set. */ public String getDescription() { return description; } /** * Bean property setter: description. * *

* Required. A short description of the response. * *

* GFM syntax can be used * for rich text representation. * * @param description The new value for the description property on this bean. * @return This object (for method chaining). */ public ResponseInfo setDescription(String description) { this.description = description; return this; } /** * Synonym for {@link #setDescription(String)}. * * @param description The new value for the description property on this bean. * @return This object (for method chaining). */ public ResponseInfo description(String description) { return setDescription(description); } /** * Bean property getter: schema. * *

* A definition of the response structure. * *

* It can be a primitive, an array or an object. * If this field does not exist, it means no content is returned as part of the response. * As an extension to the Schema Object, * its root type value may also be "file". * This SHOULD be accompanied by a relevant produces mime-type. * * @return The value of the schema property on this bean, or null if it is not set. */ public SchemaInfo getSchema() { return schema; } /** * Bean property setter: schema. * *

* A definition of the response structure. * *

* It can be a primitive, an array or an object. * If this field does not exist, it means no content is returned as part of the response. * As an extension to the Schema Object, * its root type value may also be "file". * This SHOULD be accompanied by a relevant produces mime-type. * * @param schema The new value for the schema property on this bean. * @return This object (for method chaining). */ public ResponseInfo setSchema(SchemaInfo schema) { this.schema = schema; return this; } /** * Synonym for {@link #setSchema(SchemaInfo)}. * * @param schema The new value for the schema property on this bean. * @return This object (for method chaining). */ public ResponseInfo schema(SchemaInfo schema) { return setSchema(schema); } /** * Bean property getter: headers. * *

* A list of headers that are sent with the response. * * @return The value of the headers property on this bean, or null if it is not set. */ public Map getHeaders() { return headers; } /** * Bean property setter: headers. * *

* A list of headers that are sent with the response. * * @param headers The new value for the headers property on this bean. * @return This object (for method chaining). */ public ResponseInfo setHeaders(Map headers) { this.headers = headers; return this; } /** * Bean property adder: headers. * *

* A list of headers that are sent with the response. * * @param name The header name. * @param header The header descriptions * @return This object (for method chaining). */ public ResponseInfo addHeader(String name, HeaderInfo header) { if (headers == null) headers = new TreeMap(); headers.put(name, header); return this; } /** * Synonym for {@link #addHeader(String,HeaderInfo)}. * * @param name The header name. * @param header The header descriptions * @return This object (for method chaining). */ public ResponseInfo header(String name, HeaderInfo header) { return addHeader(name, header); } /** * Bean property getter: examples. * *

* An example of the response message. * *

* Keys must be MIME-type strings. * * @return The value of the examples property on this bean, or null if it is not set. */ public Map getExamples() { return examples; } /** * Bean property setter: examples. * *

* An example of the response message. * *

* Keys must be MIME-type strings. * * @param examples The new value for the examples property on this bean. * @return This object (for method chaining). */ public ResponseInfo setExamples(Map examples) { this.examples = examples; return this; } /** * Bean property adder: examples. * *

* An example of the response message. * * @param mimeType The mimeType of the example. * @param example The example output. * @return This object (for method chaining). */ public ResponseInfo addExample(String mimeType, Object example) { if (examples == null) examples = new TreeMap(); examples.put(mimeType, example); return this; } /** * Synonym for {@link #addExample(String,Object)}. * * @param mimeType The mimeType of the example. * @param example The example output. * @return This object (for method chaining). */ public ResponseInfo example(String mimeType, Object example) { return addExample(mimeType, example); } /** * Synonym for {@link #setExamples(Map)}. * * @param examples The new value for the examples property on this bean. * @return This object (for method chaining). */ public ResponseInfo examples(Map examples) { return setExamples(examples); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy