Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package test.org.springdoc.api.v30.app237;

import io.swagger.v3.core.util.PrimitiveType;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;

Expand All @@ -10,11 +9,6 @@
@Configuration
public class OpenApiConfiguration {

public OpenApiConfiguration() {
// LocalTime support
PrimitiveType.enablePartialTime();
}

private OpenAPI standardOpenApi() {
String title = getClass().getPackage().getImplementationTitle();
String version = getClass().getPackage().getImplementationVersion();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package test.org.springdoc.api.v30.app273;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.*;

@RestController
public class HelloController {

@PostMapping("/time1")
public TimeDtoNoAnnotations postTime1(
@RequestBody TimeDtoNoAnnotations timeDto) {
return timeDto;
}

public record TimeDtoNoAnnotations(LocalDateTime localDateTime,
LocalDate localDate, LocalTime localTime,
YearMonth yearMonth, MonthDay monthDay,
Year year) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 the original author or authors.
* * * * * *
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * * * you may not use this file except in compliance with the License.
* * * * * * You may obtain a copy of the License at
* * * * * *
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
* * * * * *
* * * * * * Unless required by applicable law or agreed to in writing, software
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * * * See the License for the specific language governing permissions and
* * * * * * limitations under the License.
* * * * *
* * * *
* * *
* *
*
*/

package test.org.springdoc.api.v30.app273;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import test.org.springdoc.api.v30.AbstractSpringDocV30Test;

public class SpringDocApp273Test extends AbstractSpringDocV30Test {

@SpringBootApplication
static class SpringDocTestApp {
SpringDocTestApp() {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package test.org.springdoc.api.v31.app237;

import io.swagger.v3.core.util.PrimitiveType;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;

Expand All @@ -10,11 +9,6 @@
@Configuration
public class OpenApiConfiguration {

public OpenApiConfiguration() {
// LocalTime support
PrimitiveType.enablePartialTime();
}

private OpenAPI standardOpenApi() {
String title = getClass().getPackage().getImplementationTitle();
String version = getClass().getPackage().getImplementationVersion();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 the original author or authors.
* * * * * *
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * * * you may not use this file except in compliance with the License.
* * * * * * You may obtain a copy of the License at
* * * * * *
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
* * * * * *
* * * * * * Unless required by applicable law or agreed to in writing, software
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * * * See the License for the specific language governing permissions and
* * * * * * limitations under the License.
* * * * *
* * * *
* * *
* *
*
*/

package test.org.springdoc.api.v31.app243;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.MonthDay;
import java.time.Year;
import java.time.YearMonth;
import io.swagger.v3.oas.annotations.media.DiscriminatorMapping;
import io.swagger.v3.oas.annotations.media.Schema;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
Expand All @@ -14,15 +36,58 @@
@RestController
public class HelloController {

@PostMapping("/time1")
public TimeDtoNoAnnotations postTime1(
@RequestBody TimeDtoNoAnnotations timeDto) {
return timeDto;
@PostMapping("/parent")
public void parentEndpoint(@RequestBody SuperClass parent) {

}

}

@Schema(name = SuperClass.SCHEMA_NAME,
discriminatorProperty = "type",
oneOf = {
FirstChildClass.class,
SecondChildClass.class
},
discriminatorMapping = {
@DiscriminatorMapping(value = FirstChildClass.SCHEMA_NAME, schema = FirstChildClass.class),
@DiscriminatorMapping(value = SecondChildClass.SCHEMA_NAME, schema = SecondChildClass.class)
}
)
sealed class SuperClass {

public static final String SCHEMA_NAME = "SuperClass";

public String type;

@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
public String getType() {
return type;
}
}

@Schema(name = FirstChildClass.SCHEMA_NAME)
final class FirstChildClass extends SuperClass {

public static final String SCHEMA_NAME = "Image";

public String type;

@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
public String getType() {
return type;
}
}

@Schema(name = SecondChildClass.SCHEMA_NAME)
final class SecondChildClass extends SuperClass {

public static final String SCHEMA_NAME = "Mail";

public String type;

public record TimeDtoNoAnnotations(LocalDateTime localDateTime,
LocalDate localDate, LocalTime localTime,
YearMonth yearMonth, MonthDay monthDay,
Year year) {
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
public String getType() {
return type;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@
* *
* * *
* * * *
* * * * * Copyright 2025 the original author or authors.
* * * * *
* * * * * * Copyright 2019-2026 the original author or authors.
* * * * * *
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * * * you may not use this file except in compliance with the License.
* * * * * * You may obtain a copy of the License at
* * * * * *
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
* * * * * *
* * * * * * Unless required by applicable law or agreed to in writing, software
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * * * See the License for the specific language governing permissions and
* * * * * * limitations under the License.
* * * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * * you may not use this file except in compliance with the License.
* * * * * You may obtain a copy of the License at
* * * * *
* * * * * https://www.apache.org/licenses/LICENSE-2.0
* * * * *
* * * * * Unless required by applicable law or agreed to in writing, software
* * * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * * See the License for the specific language governing permissions and
* * * * * limitations under the License.
* * * *
* * *
* *
Expand All @@ -26,9 +24,8 @@

package test.org.springdoc.api.v31.app243;

import test.org.springdoc.api.v31.AbstractSpringDocTest;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import test.org.springdoc.api.v31.AbstractSpringDocTest;

public class SpringDocApp243Test extends AbstractSpringDocTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package test.org.springdoc.api.v31.app273;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.*;

@RestController
public class HelloController {

@PostMapping("/time1")
public TimeDtoNoAnnotations postTime1(
@RequestBody TimeDtoNoAnnotations timeDto) {
return timeDto;
}

public record TimeDtoNoAnnotations(LocalDateTime localDateTime,
LocalDate localDate, LocalTime localTime,
YearMonth yearMonth, MonthDay monthDay,
Year year) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
*
* *
* * *
* * * *
* * * * *
* * * * * * Copyright 2019-2026 the original author or authors.
* * * * * *
* * * * * * Licensed under the Apache License, Version 2.0 (the "License");
* * * * * * you may not use this file except in compliance with the License.
* * * * * * You may obtain a copy of the License at
* * * * * *
* * * * * * https://www.apache.org/licenses/LICENSE-2.0
* * * * * *
* * * * * * Unless required by applicable law or agreed to in writing, software
* * * * * * distributed under the License is distributed on an "AS IS" BASIS,
* * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * * * * * See the License for the specific language governing permissions and
* * * * * * limitations under the License.
* * * * *
* * * *
* * *
* *
*
*/

package test.org.springdoc.api.v31.app273;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import test.org.springdoc.api.v31.AbstractSpringDocTest;

public class SpringDocApp273Test extends AbstractSpringDocTest {

@SpringBootApplication
static class SpringDocTestApp {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"openapi" : "3.0.1",
"info" : {
"title" : "OpenAPI definition",
"version" : "v0"
},
"servers" : [ {
"url" : "http://localhost",
"description" : "Generated server url"
} ],
"paths" : {
"/time1" : {
"post" : {
"tags" : [ "hello-controller" ],
"operationId" : "postTime1",
"requestBody" : {
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/TimeDtoNoAnnotations"
}
}
},
"required" : true
},
"responses" : {
"200" : {
"description" : "OK",
"content" : {
"*/*" : {
"schema" : {
"$ref" : "#/components/schemas/TimeDtoNoAnnotations"
}
}
}
}
}
}
}
},
"components" : {
"schemas" : {
"TimeDtoNoAnnotations" : {
"type" : "object",
"properties" : {
"localDateTime" : {
"type" : "string",
"format" : "date-time"
},
"localDate" : {
"type" : "string",
"format" : "date"
},
"localTime" : {
"type" : "string",
"format" : "time-local"
},
"yearMonth" : {
"type" : "string"
},
"monthDay" : {
"type" : "string"
},
"year" : {
"type" : "string"
}
}
}
}
}
}
Loading
Loading