001// ***************************************************************************************************************************
002// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
003// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
004// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance            *
005// * with the License.  You may obtain a copy of the License at                                                              *
006// *                                                                                                                         *
007// *  http://www.apache.org/licenses/LICENSE-2.0                                                                             *
008// *                                                                                                                         *
009// * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an  *
010// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the        *
011// * specific language governing permissions and limitations under the License.                                              *
012// ***************************************************************************************************************************
013package org.apache.juneau.oapi.annotation;
014
015import static java.lang.annotation.ElementType.*;
016import static java.lang.annotation.RetentionPolicy.*;
017
018import java.lang.annotation.*;
019
020import org.apache.juneau.annotation.*;
021import org.apache.juneau.msgpack.*;
022import org.apache.juneau.oapi.*;
023
024/**
025 * Annotation for specifying config properties defined in {@link MsgPackSerializer} and {@link MsgPackParser}.
026 *
027 * <p>
028 * Used primarily for specifying bean configuration properties on REST classes and methods.
029 */
030@Documented
031@Target({TYPE,METHOD})
032@Retention(RUNTIME)
033@Inherited
034@PropertyStoreApply(OpenApiConfigApply.class)
035public @interface OpenApiConfig {
036
037   /**
038    * Optional rank for this config.
039    *
040    * <p>
041    * Can be used to override default ordering and application of config annotations.
042    */
043   int rank() default 0;
044
045   //-------------------------------------------------------------------------------------------------------------------
046   // OpenApiCommon
047   //-------------------------------------------------------------------------------------------------------------------
048
049   /**
050    * Dynamically applies {@link OpenApi @OpenApi} annotations to specified classes/methods/fields.
051    *
052    * <p>
053    * Provides an alternate approach for applying annotations using {@link OpenApi#on() @OpenApi.on} to specify the names
054    * to apply the annotation to.
055    *
056    * <ul class='seealso'>
057    *    <li class='link'>{@doc DynamicallyAppliedAnnotations}
058    * </ul>
059    */
060   OpenApi[] applyOpenApi() default {};
061
062   /**
063    * Default format for HTTP parts.
064    *
065    * <p>
066    * Specifies the format to use for HTTP parts when not otherwise specified via {@link org.apache.juneau.jsonschema.annotation.Schema#format()}.
067    *
068    * <p>
069    * Possible values:
070    * <ul class='javatree'>
071    *    <li class='jc'>{@link org.apache.juneau.httppart.HttpPartFormat}
072    *    <ul>
073    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#UON UON} - UON notation (e.g. <js>"'foo bar'"</js>).
074    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#INT32 INT32} - Signed 32 bits.
075    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#INT64 INT64} - Signed 64 bits.
076    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#FLOAT FLOAT} - 32-bit floating point number.
077    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#DOUBLE DOUBLE} - 64-bit floating point number.
078    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#BYTE BYTE} - BASE-64 encoded characters.
079    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#BINARY BINARY} - Hexadecimal encoded octets (e.g. <js>"00FF"</js>).
080    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#BINARY_SPACED BINARY_SPACED} - Spaced-separated hexadecimal encoded octets (e.g. <js>"00 FF"</js>).
081    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#DATE DATE} - An <a href='http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14'>RFC3339 full-date</a>.
082    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#DATE_TIME DATE_TIME} - An <a href='http://xml2rfc.ietf.org/public/rfc/html/rfc3339.html#anchor14'>RFC3339 date-time</a>.
083    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#PASSWORD PASSWORD} - Used to hint UIs the input needs to be obscured.
084    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartFormat#NO_FORMAT NO_FORMAT} - (default) Not specified.
085    *    </ul>
086    * </ul>
087    *
088    * <ul class='seealso'>
089    *    <li class='jf'>{@link OpenApiCommon#OAPI_format}
090    * </ul>
091    */
092   String format() default "";
093
094   /**
095    * Configuration property:  Default collection format for HTTP parts.
096    *
097    * <p>
098    * Specifies the collection format to use for HTTP parts when not otherwise specified via {@link org.apache.juneau.jsonschema.annotation.Schema#collectionFormat()}.
099    *
100    * <p>
101    * Possible values:
102    * <ul class='javatree'>
103    *    <li class='jc'>{@link org.apache.juneau.httppart.HttpPartFormat}
104    *    <ul>
105    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#CSV CSV} - (default) Comma-separated values (e.g. <js>"foo,bar"</js>).
106    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#SSV SSV} - Space-separated values (e.g. <js>"foo bar"</js>).
107    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#TSV TSV} - Tab-separated values (e.g. <js>"foo\tbar"</js>).
108    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#PIPES PIPES} - Pipe-separated values (e.g. <js>"foo|bar"</js>).
109    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#MULTI MULTI} - Corresponds to multiple parameter instances instead of multiple values for a single instance (e.g. <js>"foo=bar&amp;foo=baz"</js>).
110    *       <li class='jf'>{@link org.apache.juneau.httppart.HttpPartCollectionFormat#UONC UONC} - UON collection notation (e.g. <js>"@(foo,bar)"</js>).
111    *    </ul>
112    * </ul>
113    *
114    * <ul class='seealso'>
115    *    <li class='jf'>{@link OpenApiCommon#OAPI_collectionFormat}
116    * </ul>
117    */
118   String collectionFormat() default "";
119
120   //-------------------------------------------------------------------------------------------------------------------
121   // OpenApiSerializer
122   //-------------------------------------------------------------------------------------------------------------------
123
124   //-------------------------------------------------------------------------------------------------------------------
125   // OpenApiParser
126   //-------------------------------------------------------------------------------------------------------------------
127}