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.annotation; 018 019import static java.lang.annotation.RetentionPolicy.*; 020 021import java.lang.annotation.*; 022 023/** 024 * Swagger items annotation. 025 * 026 * <p> 027 * This class is essentially identical to {@link Items} except it's used for defining items of items. 028 * 029 * <p> 030 * Since annotations cannot be nested, we're forced to create a separate annotation for it. 031 * <br>If you want to nest items further, you have to define them free-form using {@link #items()} as free-form JSON. 032 * 033 * <h5 class='section'>See Also:</h5><ul> 034 * <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a> 035 * <li class='extlink'><a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a> 036 037 * </ul> 038 */ 039@Documented 040@Retention(RUNTIME) 041public @interface SubItems { 042 043 /** 044 * <mk>default</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 045 * 046 * <h5 class='section'>Notes:</h5><ul> 047 * <li class='note'> 048 * The format is a plain-text string. 049 * </ul> 050 * 051 * @return The annotation value. 052 */ 053 String[] _default() default {}; 054 055 /** 056 * Optional description for the exposed API. 057 * 058 * @return The annotation value. 059 * @since 9.2.0 060 */ 061 String[] description() default {}; 062 063 /** 064 * <mk>enum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 065 * 066 * <h5 class='section'>Notes:</h5><ul> 067 * <li class='note'> 068 * The format is a plain-text string. 069 * </ul> 070 * 071 * @return The annotation value. 072 */ 073 String[] _enum() default {}; 074 075 /** 076 * <mk>$ref</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 077 * 078 * <h5 class='section'>Notes:</h5><ul> 079 * <li class='note'> 080 * The format is a plain-text string. 081 * </ul> 082 * 083 * @return The annotation value. 084 */ 085 String $ref() default ""; 086 087 /** 088 * Synonym for {@link #collectionFormat()}. 089 * 090 * @return The annotation value. 091 */ 092 String cf() default ""; 093 094 /** 095 * <mk>collectionFormat</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 096 * 097 * <h5 class='section'>Notes:</h5><ul> 098 * <li class='note'> 099 * The format is a plain-text string. 100 * </ul> 101 * 102 * @return The annotation value. 103 */ 104 String collectionFormat() default ""; 105 106 /** 107 * Synonym for {@link #_default()}. 108 * 109 * @return The annotation value. 110 */ 111 String[] df() default {}; 112 113 /** 114 * Synonym for {@link #_enum()}. 115 * 116 * @return The annotation value. 117 */ 118 String[] e() default {}; 119 120 /** 121 * Synonym for {@link #exclusiveMaximum()}. 122 * 123 * @return The annotation value. 124 */ 125 boolean emax() default false; 126 127 /** 128 * Synonym for {@link #exclusiveMinimum()}. 129 * 130 * @return The annotation value. 131 */ 132 boolean emin() default false; 133 134 /** 135 * <mk>exclusiveMaximum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 136 * 137 * <h5 class='section'>Notes:</h5><ul> 138 * <li class='note'> 139 * The format is a plain-text string. 140 * </ul> 141 * 142 * @return The annotation value. 143 */ 144 boolean exclusiveMaximum() default false; 145 146 /** 147 * <mk>exclusiveMinimum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 148 * 149 * <h5 class='section'>Notes:</h5><ul> 150 * <li class='note'> 151 * The format is a plain-text string. 152 * </ul> 153 * 154 * @return The annotation value. 155 */ 156 boolean exclusiveMinimum() default false; 157 158 /** 159 * Synonym for {@link #format()}. 160 * 161 * @return The annotation value. 162 */ 163 String f() default ""; 164 165 /** 166 * <mk>format</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 167 * 168 * <h5 class='section'>Notes:</h5><ul> 169 * <li class='note'> 170 * The format is a plain-text string. 171 * </ul> 172 * 173 * @return The annotation value. 174 */ 175 String format() default ""; 176 177 /** 178 * <mk>items</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 179 * 180 * <p> 181 * Describes the type of items in the array. 182 * 183 * <p> 184 * This is a <a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauBeanSwagger2">juneau-bean-swagger-v2</a> object. 185 * <br>It must be declared free-form because it's not possible to nest annotations in Java. 186 * 187 * @return The annotation value. 188 */ 189 String[] items() default {}; 190 191 /** 192 * Synonym for {@link #maximum()}. 193 * 194 * @return The annotation value. 195 */ 196 String max() default ""; 197 198 /** 199 * Synonym for {@link #maxItems()}. 200 * 201 * @return The annotation value. 202 */ 203 long maxi() default -1; 204 205 /** 206 * <mk>maximum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 207 * 208 * <h5 class='section'>Notes:</h5><ul> 209 * <li class='note'> 210 * The format is a plain-text string. 211 * </ul> 212 * 213 * @return The annotation value. 214 */ 215 String maximum() default ""; 216 217 /** 218 * <mk>maxItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 219 * 220 * <h5 class='section'>Notes:</h5><ul> 221 * <li class='note'> 222 * The format is a plain-text string. 223 * </ul> 224 * 225 * @return The annotation value. 226 */ 227 long maxItems() default -1; 228 229 /** 230 * Synonym for {@link #maxLength()}. 231 * 232 * @return The annotation value. 233 */ 234 long maxl() default -1; 235 236 /** 237 * <mk>maxLength</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 238 * 239 * <h5 class='section'>Notes:</h5><ul> 240 * <li class='note'> 241 * The format is a plain-text string. 242 * </ul> 243 * 244 * @return The annotation value. 245 */ 246 long maxLength() default -1; 247 248 /** 249 * Synonym for {@link #minimum()}. 250 * 251 * @return The annotation value. 252 */ 253 String min() default ""; 254 255 /** 256 * Synonym for {@link #minItems()}. 257 * 258 * @return The annotation value. 259 */ 260 long mini() default -1; 261 262 /** 263 * <mk>minimum</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 264 * 265 * <h5 class='section'>Notes:</h5><ul> 266 * <li class='note'> 267 * The format is a plain-text string. 268 * </ul> 269 * 270 * @return The annotation value. 271 */ 272 String minimum() default ""; 273 274 /** 275 * <mk>minItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 276 * 277 * <h5 class='section'>Notes:</h5><ul> 278 * <li class='note'> 279 * The format is a plain-text string. 280 * </ul> 281 * 282 * @return The annotation value. 283 */ 284 long minItems() default -1; 285 286 /** 287 * Synonym for {@link #minLength()}. 288 * 289 * @return The annotation value. 290 */ 291 long minl() default -1; 292 293 /** 294 * <mk>minLength</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 295 * 296 * <h5 class='section'>Notes:</h5><ul> 297 * <li class='note'> 298 * The format is a plain-text string. 299 * </ul> 300 * 301 * @return The annotation value. 302 */ 303 long minLength() default -1; 304 305 /** 306 * Synonym for {@link #multipleOf()}. 307 * 308 * @return The annotation value. 309 */ 310 String mo() default ""; 311 312 /** 313 * <mk>multipleOf</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 314 * 315 * <h5 class='section'>Notes:</h5><ul> 316 * <li class='note'> 317 * The format is a plain-text string. 318 * </ul> 319 * 320 * @return The annotation value. 321 */ 322 String multipleOf() default ""; 323 324 /** 325 * Synonym for {@link #pattern()}. 326 * 327 * @return The annotation value. 328 */ 329 String p() default ""; 330 331 /** 332 * <mk>pattern</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 333 * 334 * <h5 class='section'>Notes:</h5><ul> 335 * <li class='note'> 336 * The format is a plain-text string. 337 * </ul> 338 * 339 * @return The annotation value. 340 */ 341 String pattern() default ""; 342 343 /** 344 * Synonym for {@link #type()}. 345 * 346 * @return The annotation value. 347 */ 348 String t() default ""; 349 350 /** 351 * <mk>type</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 352 * 353 * <h5 class='section'>Notes:</h5><ul> 354 * <li class='note'> 355 * The format is a plain-text string. 356 * </ul> 357 * 358 * @return The annotation value. 359 */ 360 String type() default ""; 361 362 /** 363 * Synonym for {@link #uniqueItems()}. 364 * 365 * @return The annotation value. 366 */ 367 boolean ui() default false; 368 369 /** 370 * <mk>uniqueItems</mk> field of the <a class="doclink" href="https://swagger.io/specification/v2#itemsObject">Swagger Items Object</a>. 371 * 372 * <h5 class='section'>Notes:</h5><ul> 373 * <li class='note'> 374 * The format is a plain-text string. 375 * </ul> 376 * 377 * @return The annotation value. 378 */ 379 boolean uniqueItems() default false; 380}