1 /**
2 * Copyright 2017 SmartBear Software
3 * <p>
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 * <p>
8 * http://www.apache.org/licenses/LICENSE-2.0
9 * <p>
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package io.swagger.v3.oas.annotations.media;
18
19 import java.lang.annotation.Inherited;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24 /**
25 * The annotation may be used in {@link Schema#discriminatorMapping()} to define an optional mapping definition
26 * in scenarios involving composition / inheritance where the value of the discriminator field does not match the schema
27 * name or implicit mapping is not possible.
28 *
29 * <p>Use {@link Schema#discriminatorProperty()} to define a discriminator property.</p>
30 *
31 * @see <a target="_new" href="https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#discriminatorObject">Discriminator (OpenAPI specification)</a>
32 * @see Schema
33 **/
34 @Target({})
35 @Retention(RetentionPolicy.RUNTIME)
36 @Inherited
37 public @interface DiscriminatorMapping {
38
39 /**
40 * The property value that will be mapped to a Schema
41 *
42 * @return the property value
43 **/
44 String value() default "";
45
46 /**
47 * The schema that is being mapped to a property value
48 *
49 * @return the Schema reference
50 **/
51 Class<?> schema() default Void.class;
52
53 }
54