-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenAPI FAT tests for annotation usage warnings
- Loading branch information
Showing
10 changed files
with
452 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
dev/io.openliberty.microprofile.openapi.4.0.internal_fat/build.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
|
||
dependencies { | ||
requiredLibs project(path: ':io.openliberty.org.eclipse.microprofile', configuration: 'openapi40') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
270 changes: 270 additions & 0 deletions
270
.../fat/src/io/openliberty/microprofile/openapi40/fat/versionwarning/VersionWarningTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
69 changes: 69 additions & 0 deletions
69
.../openliberty/microprofile/openapi40/fat/versionwarning/app/VersionWarningApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package io.openliberty.microprofile.openapi40.fat.versionwarning.app; | ||
|
||
import org.eclipse.microprofile.openapi.annotations.Components; | ||
import org.eclipse.microprofile.openapi.annotations.OpenAPIDefinition; | ||
import org.eclipse.microprofile.openapi.annotations.PathItem; | ||
import org.eclipse.microprofile.openapi.annotations.PathItemOperation; | ||
import org.eclipse.microprofile.openapi.annotations.enums.SchemaType; | ||
import org.eclipse.microprofile.openapi.annotations.info.Info; | ||
import org.eclipse.microprofile.openapi.annotations.info.License; | ||
import org.eclipse.microprofile.openapi.annotations.media.DependentRequired; | ||
import org.eclipse.microprofile.openapi.annotations.media.DependentSchema; | ||
import org.eclipse.microprofile.openapi.annotations.media.PatternProperty; | ||
import org.eclipse.microprofile.openapi.annotations.media.Schema; | ||
import org.eclipse.microprofile.openapi.annotations.media.SchemaProperty; | ||
|
||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaA; | ||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaB; | ||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaC; | ||
import jakarta.ws.rs.ApplicationPath; | ||
import jakarta.ws.rs.core.Application; | ||
|
||
@ApplicationPath("/") | ||
@OpenAPIDefinition(info = @Info(title = "test", version = "0.1", summary = "test", | ||
license = @License(name = "Example License 1.0", identifier = "EXAMPLE-1.0")), | ||
components = @Components(pathItems = @PathItem(name = "testPathItem", | ||
operations = @PathItemOperation(method = "GET", | ||
description = "example callback operation")), | ||
schemas = @Schema(name = "componentSchema", | ||
properties = { @SchemaProperty(name = "prop1", | ||
type = SchemaType.OBJECT, | ||
comment = "testComment", | ||
additionalProperties = VersionWarningDataObject.class, | ||
ifSchema = SubschemaA.class, | ||
thenSchema = SubschemaB.class, | ||
elseSchema = SubschemaC.class, | ||
dependentSchemas = @DependentSchema(name = "prop2", | ||
schema = SubschemaA.class)), | ||
@SchemaProperty(name = "prop2", | ||
contains = SubschemaA.class, | ||
minContains = 1, | ||
maxContains = 6, | ||
prefixItems = { SubschemaB.class, | ||
SubschemaB.class }), | ||
@SchemaProperty(name = "prop3", | ||
type = SchemaType.OBJECT, | ||
patternProperties = @PatternProperty(regex = "test\\..*", | ||
schema = SubschemaA.class), | ||
dependentRequired = @DependentRequired(name = "prop2", | ||
requires = "prop3"), | ||
propertyNames = SubschemaC.class), | ||
@SchemaProperty(name = "prop4", | ||
type = SchemaType.STRING, | ||
contentEncoding = "base64", | ||
contentMediaType = "application/json", | ||
contentSchema = SubschemaC.class) | ||
})), | ||
webhooks = @PathItem(name = "testWebhook")) | ||
public class VersionWarningApplication extends Application { | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
...o/openliberty/microprofile/openapi40/fat/versionwarning/app/VersionWarningDataObject.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package io.openliberty.microprofile.openapi40.fat.versionwarning.app; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.microprofile.openapi.annotations.media.DependentRequired; | ||
import org.eclipse.microprofile.openapi.annotations.media.DependentSchema; | ||
import org.eclipse.microprofile.openapi.annotations.media.PatternProperty; | ||
import org.eclipse.microprofile.openapi.annotations.media.Schema; | ||
|
||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaA; | ||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaB; | ||
import io.openliberty.microprofile.openapi40.fat.versionwarning.app.VersionWarningDataObject.SubschemaC; | ||
|
||
@Schema(comment = "test comment", | ||
constValue = "3", | ||
ifSchema = SubschemaA.class, | ||
thenSchema = SubschemaB.class, | ||
elseSchema = SubschemaC.class, | ||
dependentSchemas = @DependentSchema(name = "test", schema = SubschemaC.class), | ||
patternProperties = @PatternProperty(regex = "testPattern", schema = SubschemaC.class), | ||
dependentRequired = @DependentRequired(name = "testA", requires = { "testB", "testC" }), | ||
propertyNames = SubschemaB.class) | ||
public class VersionWarningDataObject { | ||
|
||
public static class SubschemaA {} | ||
|
||
public static class SubschemaB {} | ||
|
||
public static class SubschemaC {} | ||
|
||
@Schema(contains = SubschemaC.class, minContains = 1, maxContains = 6, prefixItems = { SubschemaA.class, SubschemaA.class }) | ||
private List<String> testList; | ||
|
||
@Schema(contentEncoding = "base64", contentMediaType = "application/json", contentSchema = SubschemaC.class) | ||
private String encodedTest; | ||
} |
25 changes: 25 additions & 0 deletions
25
.../io/openliberty/microprofile/openapi40/fat/versionwarning/app/VersionWarningResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 IBM Corporation and others. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package io.openliberty.microprofile.openapi40.fat.versionwarning.app; | ||
|
||
import org.eclipse.microprofile.openapi.annotations.callbacks.Callback; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
|
||
@Path("/") | ||
public class VersionWarningResource { | ||
|
||
@GET | ||
@Callback(name = "test", callbackUrlExpression = "/callback/test", pathItemRef = "testPathItem") | ||
public String getTest() { | ||
return "test"; | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...openapi.4.0.internal_fat/publish/servers/OpenAPIVersionWarningServer/bootstrap.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bootstrap.include=../testports.properties | ||
com.ibm.ws.logging.trace.specification=*=info=enabled:mpOpenAPI=debug |
13 changes: 13 additions & 0 deletions
13
...roprofile.openapi.4.0.internal_fat/publish/servers/OpenAPIVersionWarningServer/server.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<server description="Server for OpenAPI model validation testing"> | ||
|
||
<!-- Enable features --> | ||
<featureManager> | ||
<feature>mpOpenAPI-4.0</feature> | ||
<feature>componenttest-2.0</feature> | ||
<feature>restfulWS-3.1</feature> <!-- EE feature to ensure we get the expected EE version --> | ||
<feautre>mpConfig-3.1</feautre> | ||
</featureManager> | ||
|
||
<include location="../fatTestPorts.xml" /> | ||
|
||
</server> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters