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.http.annotation; 014 015import static java.lang.annotation.RetentionPolicy.*; 016 017import java.lang.annotation.*; 018 019/** 020 * @deprecated Use {@link org.apache.juneau.jsonschema.annotation.Items} 021 */ 022@Documented 023@Retention(RUNTIME) 024@Deprecated 025public @interface Items { 026 027 /** 028 * <mk>type</mk> field of the {@doc SwaggerItemsObject}. 029 * 030 * <h5 class='section'>Notes:</h5> 031 * <ul class='spaced-list'> 032 * <li> 033 * The format is a plain-text string. 034 * <li> 035 * Supports {@doc DefaultRestSvlVariables} 036 * (e.g. <js>"$L{my.localized.variable}"</js>). 037 * </ul> 038 */ 039 String type() default ""; 040 041 /** 042 * <mk>format</mk> field of the {@doc SwaggerItemsObject}. 043 * 044 * <h5 class='section'>Notes:</h5> 045 * <ul class='spaced-list'> 046 * <li> 047 * The format is a plain-text string. 048 * <li> 049 * Supports {@doc DefaultRestSvlVariables} 050 * (e.g. <js>"$L{my.localized.variable}"</js>). 051 * </ul> 052 */ 053 String format() default ""; 054 055 /** 056 * <mk>collectionFormat</mk> field of the {@doc SwaggerItemsObject}. 057 * 058 * <h5 class='section'>Notes:</h5> 059 * <ul class='spaced-list'> 060 * <li> 061 * The format is a plain-text string. 062 * <li> 063 * Supports {@doc DefaultRestSvlVariables} 064 * (e.g. <js>"$L{my.localized.variable}"</js>). 065 * </ul> 066 */ 067 String collectionFormat() default ""; 068 069 /** 070 * <mk>pattern</mk> field of the {@doc SwaggerItemsObject}. 071 * 072 * <h5 class='section'>Notes:</h5> 073 * <ul class='spaced-list'> 074 * <li> 075 * The format is a plain-text string. 076 * <li> 077 * Supports {@doc DefaultRestSvlVariables} 078 * (e.g. <js>"$L{my.localized.variable}"</js>). 079 * </ul> 080 */ 081 String pattern() default ""; 082 083 /** 084 * <mk>maximum</mk> field of the {@doc SwaggerItemsObject}. 085 * 086 * <h5 class='section'>Notes:</h5> 087 * <ul class='spaced-list'> 088 * <li> 089 * The format is a plain-text string. 090 * <li> 091 * Supports {@doc DefaultRestSvlVariables} 092 * (e.g. <js>"$L{my.localized.variable}"</js>). 093 * </ul> 094 */ 095 String maximum() default ""; 096 097 /** 098 * <mk>minimum</mk> field of the {@doc SwaggerItemsObject}. 099 * 100 * <h5 class='section'>Notes:</h5> 101 * <ul class='spaced-list'> 102 * <li> 103 * The format is a plain-text string. 104 * <li> 105 * Supports {@doc DefaultRestSvlVariables} 106 * (e.g. <js>"$L{my.localized.variable}"</js>). 107 * </ul> 108 */ 109 String minimum() default ""; 110 111 /** 112 * <mk>multipleOf</mk> field of the {@doc SwaggerItemsObject}. 113 * 114 * <h5 class='section'>Notes:</h5> 115 * <ul class='spaced-list'> 116 * <li> 117 * The format is a plain-text string. 118 * <li> 119 * Supports {@doc DefaultRestSvlVariables} 120 * (e.g. <js>"$L{my.localized.variable}"</js>). 121 * </ul> 122 */ 123 String multipleOf() default ""; 124 125 /** 126 * <mk>maxLength</mk> field of the {@doc SwaggerItemsObject}. 127 * 128 * <h5 class='section'>Notes:</h5> 129 * <ul class='spaced-list'> 130 * <li> 131 * The format is a plain-text string. 132 * <li> 133 * Supports {@doc DefaultRestSvlVariables} 134 * (e.g. <js>"$L{my.localized.variable}"</js>). 135 * </ul> 136 */ 137 long maxLength() default -1; 138 139 /** 140 * <mk>minLength</mk> field of the {@doc SwaggerItemsObject}. 141 * 142 * <h5 class='section'>Notes:</h5> 143 * <ul class='spaced-list'> 144 * <li> 145 * The format is a plain-text string. 146 * <li> 147 * Supports {@doc DefaultRestSvlVariables} 148 * (e.g. <js>"$L{my.localized.variable}"</js>). 149 * </ul> 150 */ 151 long minLength() default -1; 152 153 /** 154 * <mk>maxItems</mk> field of the {@doc SwaggerItemsObject}. 155 * 156 * <h5 class='section'>Notes:</h5> 157 * <ul class='spaced-list'> 158 * <li> 159 * The format is a plain-text string. 160 * <li> 161 * Supports {@doc DefaultRestSvlVariables} 162 * (e.g. <js>"$L{my.localized.variable}"</js>). 163 * </ul> 164 */ 165 long maxItems() default -1; 166 167 /** 168 * <mk>minItems</mk> field of the {@doc SwaggerItemsObject}. 169 * 170 * <h5 class='section'>Notes:</h5> 171 * <ul class='spaced-list'> 172 * <li> 173 * The format is a plain-text string. 174 * <li> 175 * Supports {@doc DefaultRestSvlVariables} 176 * (e.g. <js>"$L{my.localized.variable}"</js>). 177 * </ul> 178 */ 179 long minItems() default -1; 180 181 /** 182 * <mk>exclusiveMaximum</mk> field of the {@doc SwaggerItemsObject}. 183 * 184 * <h5 class='section'>Notes:</h5> 185 * <ul class='spaced-list'> 186 * <li> 187 * The format is a plain-text string. 188 * <li> 189 * Supports {@doc DefaultRestSvlVariables} 190 * (e.g. <js>"$L{my.localized.variable}"</js>). 191 * </ul> 192 */ 193 boolean exclusiveMaximum() default false; 194 195 /** 196 * <mk>exclusiveMinimum</mk> field of the {@doc SwaggerItemsObject}. 197 * 198 * <h5 class='section'>Notes:</h5> 199 * <ul class='spaced-list'> 200 * <li> 201 * The format is a plain-text string. 202 * <li> 203 * Supports {@doc DefaultRestSvlVariables} 204 * (e.g. <js>"$L{my.localized.variable}"</js>). 205 * </ul> 206 */ 207 boolean exclusiveMinimum() default false; 208 209 /** 210 * <mk>uniqueItems</mk> field of the {@doc SwaggerItemsObject}. 211 * 212 * <h5 class='section'>Notes:</h5> 213 * <ul class='spaced-list'> 214 * <li> 215 * The format is a plain-text string. 216 * <li> 217 * Supports {@doc DefaultRestSvlVariables} 218 * (e.g. <js>"$L{my.localized.variable}"</js>). 219 * </ul> 220 */ 221 boolean uniqueItems() default false; 222 223 /** 224 * <mk>default</mk> field of the {@doc SwaggerItemsObject}. 225 * 226 * <h5 class='section'>Notes:</h5> 227 * <ul class='spaced-list'> 228 * <li> 229 * The format is a plain-text string. 230 * <li> 231 * Supports {@doc DefaultRestSvlVariables} 232 * (e.g. <js>"$L{my.localized.variable}"</js>). 233 * </ul> 234 */ 235 String[] _default() default {}; 236 237 /** 238 * <mk>enum</mk> field of the {@doc SwaggerItemsObject}. 239 * 240 * <h5 class='section'>Notes:</h5> 241 * <ul class='spaced-list'> 242 * <li> 243 * The format is a plain-text string. 244 * <li> 245 * Supports {@doc DefaultRestSvlVariables} 246 * (e.g. <js>"$L{my.localized.variable}"</js>). 247 * </ul> 248 */ 249 String[] _enum() default {}; 250 251 /** 252 * <mk>$ref</mk> field of the {@doc SwaggerItemsObject}. 253 * 254 * <h5 class='section'>Notes:</h5> 255 * <ul class='spaced-list'> 256 * <li> 257 * The format is a plain-text string. 258 * <li> 259 * Supports {@doc DefaultRestSvlVariables} 260 * (e.g. <js>"$L{my.localized.variable}"</js>). 261 * </ul> 262 */ 263 String $ref() default ""; 264 265 /** 266 * <mk>items</mk> field of the {@doc SwaggerItemsObject}. 267 * 268 * <p> 269 * Describes the type of items in the array. 270 */ 271 SubItems items() default @SubItems; 272 273 /** 274 * Free-form value for the {@doc SwaggerItemsObject}. 275 * 276 * <p> 277 * This is a {@doc juneau-marshall.JsonDetails.SimplifiedJson} object that makes up the swagger information for this field. 278 * 279 * <p> 280 * The following are completely equivalent ways of defining the swagger description of an Items object: 281 * <p class='bcode w800'> 282 * <jc>// Normal</jc> 283 * <ja>@Query</ja>( 284 * name=<js>"status"</js>, 285 * type=<js>"array"</js>, 286 * items=<ja>@Items</ja>( 287 * type=<js>"string"</js>, 288 * _enum=<js>"AVAILABLE,PENDING,SOLD"</js>, 289 * _default=<js>"AVAILABLE"</js> 290 * ) 291 * ) 292 * </p> 293 * <p class='bcode w800'> 294 * <jc>// Free-form</jc> 295 * <ja>@Query</ja>( 296 * name=<js>"status"</js>, 297 * type=<js>"array"</js>, 298 * items=<ja>@Items</ja>({ 299 * <js>"type: 'string'"</js>, 300 * <js>"enum: ['AVAILABLE','PENDING','SOLD'],"</js>, 301 * <js>"default: 'AVAILABLE'"</js> 302 * }) 303 * ) 304 * </p> 305 * <p class='bcode w800'> 306 * <jc>// Free-form as part of parent</jc> 307 * <ja>@Query</ja>( 308 * name=<js>"status"</js>, 309 * api={ 310 * <js>"type:'array',"</js>, 311 * <js>"items: {"</js>, 312 * <js>"type: 'string',"</js>, 313 * <js>"enum: ['AVAILABLE','PENDING','SOLD'],"</js>, 314 * <js>"default: 'AVAILABLE'"</js>, 315 * <js>"}"</js>) 316 * } 317 * ) 318 * </p> 319 * <p class='bcode w800'> 320 * <jc>// Free-form with variables</jc> 321 * <ja>@Query</ja>( 322 * name=<js>"status"</js>, 323 * type=<js>"array"</js>, 324 * items=<ja>@Items</ja>(<js>"$L{statusItemsSwagger}"</js>) 325 * ) 326 * </p> 327 * <p class='bcode w800'> 328 * <mc>// Contents of MyResource.properties</mc> 329 * <mk>statusItemsSwagger</mk> = <mv>{ type: "string", enum: ["AVAILABLE","PENDING","SOLD"], default: "AVAILABLE" }</mv> 330 * </p> 331 * 332 * <p> 333 * The reasons why you may want to use this field include: 334 * <ul> 335 * <li>You want to pull in the entire Swagger JSON definition for this field from an external source such as a properties file. 336 * <li>You want to add extra fields to the Swagger documentation that are not officially part of the Swagger specification. 337 * </ul> 338 * 339 * <h5 class='section'>Notes:</h5> 340 * <ul class='spaced-list'> 341 * <li> 342 * Note that the only swagger field you can't specify using this value is <js>"name"</js> whose value needs to be known during servlet initialization. 343 * <li> 344 * The format is a {@doc juneau-marshall.JsonDetails.SimplifiedJson} object. 345 * <li> 346 * The leading/trailing <code>{ }</code> characters are optional. 347 * <br>The following two example are considered equivalent: 348 * <p class='bcode w800'> 349 * <ja>@Items</ja>(api=<js>"{type: 'string'}"</js>) 350 * </p> 351 * <p class='bcode w800'> 352 * <ja>@Items</ja>(api=<js>"type: 'string'"</js>) 353 * </p> 354 * <li> 355 * Multiple lines are concatenated with newlines so that you can format the value to be readable. 356 * <li> 357 * Supports {@doc DefaultRestSvlVariables} 358 * (e.g. <js>"$L{my.localized.variable}"</js>). 359 * <li> 360 * Values defined in this field supersede values pulled from the Swagger JSON file and are superseded by individual values defined on this annotation. 361 * </ul> 362 */ 363 String[] value() default {}; 364}