|
| 1 | +/* |
| 2 | + * |
| 3 | + * * |
| 4 | + * * * |
| 5 | + * * * * |
| 6 | + * * * * * |
| 7 | + * * * * * * Copyright 2019-2025 the original author or authors. |
| 8 | + * * * * * * |
| 9 | + * * * * * * Licensed under the Apache License, Version 2.0 (the "License"); |
| 10 | + * * * * * * you may not use this file except in compliance with the License. |
| 11 | + * * * * * * You may obtain a copy of the License at |
| 12 | + * * * * * * |
| 13 | + * * * * * * https://www.apache.org/licenses/LICENSE-2.0 |
| 14 | + * * * * * * |
| 15 | + * * * * * * Unless required by applicable law or agreed to in writing, software |
| 16 | + * * * * * * distributed under the License is distributed on an "AS IS" BASIS, |
| 17 | + * * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 18 | + * * * * * * See the License for the specific language governing permissions and |
| 19 | + * * * * * * limitations under the License. |
| 20 | + * * * * * |
| 21 | + * * * * |
| 22 | + * * * |
| 23 | + * * |
| 24 | + * |
| 25 | + */ |
| 26 | + |
| 27 | +package test.org.springdoc.api.v30.app241; |
| 28 | + |
| 29 | + |
| 30 | +import com.fasterxml.jackson.annotation.JsonTypeInfo; |
| 31 | +import io.swagger.v3.oas.annotations.media.Schema; |
| 32 | + |
| 33 | +import org.springframework.web.bind.annotation.PostMapping; |
| 34 | +import org.springframework.web.bind.annotation.RequestBody; |
| 35 | +import org.springframework.web.bind.annotation.RestController; |
| 36 | + |
| 37 | +@RestController |
| 38 | +public class HelloController { |
| 39 | + |
| 40 | + @PostMapping("/parent") |
| 41 | + public void parentEndpoint(@RequestBody Superclass parent) { |
| 42 | + |
| 43 | + } |
| 44 | + |
| 45 | +} |
| 46 | + |
| 47 | +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "@type") |
| 48 | +sealed class Superclass permits IntermediateClass { |
| 49 | + |
| 50 | + public Superclass() {} |
| 51 | +} |
| 52 | + |
| 53 | +@Schema(name = IntermediateClass.SCHEMA_NAME) |
| 54 | +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "@type") |
| 55 | +sealed class IntermediateClass extends Superclass permits FirstChildClass, SecondChildClass { |
| 56 | + |
| 57 | + public static final String SCHEMA_NAME = "IntermediateClass"; |
| 58 | +} |
| 59 | + |
| 60 | +@Schema(name = FirstChildClass.SCHEMA_NAME) |
| 61 | +final class FirstChildClass extends IntermediateClass { |
| 62 | + |
| 63 | + public static final String SCHEMA_NAME = "Image"; |
| 64 | +} |
| 65 | + |
| 66 | +@Schema(name = SecondChildClass.SCHEMA_NAME) |
| 67 | +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "@type") |
| 68 | +sealed class SecondChildClass extends IntermediateClass { |
| 69 | + |
| 70 | + public static final String SCHEMA_NAME = "Mail"; |
| 71 | +} |
| 72 | + |
| 73 | +@Schema(name = ThirdChildClass.SCHEMA_NAME) |
| 74 | +final class ThirdChildClass extends SecondChildClass { |
| 75 | + |
| 76 | + public static final String SCHEMA_NAME = "Home"; |
| 77 | +} |
0 commit comments