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