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.SubItems} 021 */ 022@Documented 023@Retention(RUNTIME) 024@Deprecated 025public @interface SubItems { 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 * <p> 272 * This is a {@doc juneau-marshall.JsonDetails.SimplifiedJson} object. 273 * <br>It must be declared free-form because it's not possible to nest annotations in Java. 274 */ 275 String[] items() default {}; 276 277 /** 278 * Free-form value for the {@doc SwaggerItemsObject}. 279 * 280 * <p> 281 * This is a {@doc juneau-marshall.JsonDetails.SimplifiedJson} object that makes up the swagger information for this field. 282 * 283 * <p> 284 * The following are completely equivalent ways of defining the swagger description of an Items object: 285 * <p class='bcode w800'> 286 * <jc>// Normal</jc> 287 * <ja>@Query</ja>( 288 * name=<js>"status"</js>, 289 * type=<js>"array"</js>, 290 * items=<ja>@Items</ja>( 291 * type=<js>"string"</js>, 292 * _enum=<js>"AVAILABLE,PENDING,SOLD"</js>, 293 * _default=<js>"AVAILABLE"</js> 294 * ) 295 * ) 296 * </p> 297 * <p class='bcode w800'> 298 * <jc>// Free-form</jc> 299 * <ja>@Query</ja>( 300 * name=<js>"status"</js>, 301 * type=<js>"array"</js>, 302 * items=<ja>@Items</ja>({ 303 * <js>"type: 'string'"</js>, 304 * <js>"enum: ['AVAILABLE','PENDING','SOLD'],"</js>, 305 * <js>"default: 'AVAILABLE'"</js> 306 * }) 307 * ) 308 * </p> 309 * <p class='bcode w800'> 310 * <jc>// Free-form as part of parent</jc> 311 * <ja>@Query</ja>( 312 * name=<js>"status"</js>, 313 * api={ 314 * <js>"type:'array',"</js>, 315 * <js>"items: {"</js>, 316 * <js>"type: 'string',"</js>, 317 * <js>"enum: ['AVAILABLE','PENDING','SOLD'],"</js>, 318 * <js>"default: 'AVAILABLE'"</js>, 319 * <js>"}"</js>) 320 * } 321 * ) 322 * </p> 323 * <p class='bcode w800'> 324 * <jc>// Free-form with variables</jc> 325 * <ja>@Query</ja>( 326 * name=<js>"status"</js>, 327 * type=<js>"array"</js>, 328 * items=<ja>@Items</ja>(<js>"$L{statusItemsSwagger}"</js>) 329 * ) 330 * </p> 331 * <p class='bcode w800'> 332 * <mc>// Contents of MyResource.properties</mc> 333 * <mk>statusItemsSwagger</mk> = <mv>{ type: "string", enum: ["AVAILABLE","PENDING","SOLD"], default: "AVAILABLE" }</mv> 334 * </p> 335 * 336 * <p> 337 * The reasons why you may want to use this field include: 338 * <ul> 339 * <li>You want to pull in the entire Swagger JSON definition for this field from an external source such as a properties file. 340 * <li>You want to add extra fields to the Swagger documentation that are not officially part of the Swagger specification. 341 * </ul> 342 * 343 * <h5 class='section'>Notes:</h5> 344 * <ul class='spaced-list'> 345 * <li> 346 * 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. 347 * <li> 348 * The format is a {@doc juneau-marshall.JsonDetails.SimplifiedJson} object. 349 * <li> 350 * The leading/trailing <code>{ }</code> characters are optional. 351 * <br>The following two example are considered equivalent: 352 * <p class='bcode w800'> 353 * <ja>@Items</ja>(api=<js>"{type: 'string'}"</js>) 354 * </p> 355 * <p class='bcode w800'> 356 * <ja>@Items</ja>(api=<js>"type: 'string'"</js>) 357 * </p> 358 * <li> 359 * Multiple lines are concatenated with newlines so that you can format the value to be readable. 360 * <li> 361 * Supports {@doc DefaultRestSvlVariables} 362 * (e.g. <js>"$L{my.localized.variable}"</js>). 363 * <li> 364 * Values defined in this field supersede values pulled from the Swagger JSON file and are superseded by individual values defined on this annotation. 365 * </ul> 366 */ 367 String[] value() default {}; 368}