diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/media/SchemaImpl.java b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/media/SchemaImpl.java index 69bbb7f45cf..6acae83c031 100644 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/media/SchemaImpl.java +++ b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/model/media/SchemaImpl.java @@ -1,7 +1,7 @@ /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * - * Copyright (c) [2021] Payara Foundation and/or its affiliates. All rights reserved. + * Copyright (c) [2018-2020] Payara Foundation and/or its affiliates. All rights reserved. * * The contents of this file are subject to the terms of either the GNU * General Public License Version 2 only ("GPL") or the Common Development @@ -43,10 +43,13 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonMappingException; + import fish.payara.microprofile.openapi.api.visitor.ApiContext; import fish.payara.microprofile.openapi.impl.model.ExtensibleImpl; import fish.payara.microprofile.openapi.impl.model.ExternalDocumentationImpl; import fish.payara.microprofile.openapi.impl.model.util.ModelUtils; +import fish.payara.microprofile.openapi.impl.rest.app.provider.ObjectMapperFactory; + import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.applyReference; import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.createList; import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.createMap; @@ -54,14 +57,16 @@ import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.mergeImmutableList; import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.mergeProperty; import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.readOnlyView; -import fish.payara.microprofile.openapi.impl.rest.app.provider.ObjectMapperFactory; import java.math.BigDecimal; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Map.Entry; + import static java.util.logging.Level.WARNING; + import java.util.logging.Logger; + import org.eclipse.microprofile.openapi.models.ExternalDocumentation; import org.eclipse.microprofile.openapi.models.media.Discriminator; import org.eclipse.microprofile.openapi.models.media.Schema; @@ -128,6 +133,7 @@ public static SchemaImpl valueOf(String content) throws JsonMappingException, Js .readValue(content, SchemaImpl.class); } + @SuppressWarnings("unchecked") public static SchemaImpl createInstance(AnnotationModel annotation, ApiContext context) { SchemaImpl from = new SchemaImpl(); @@ -135,18 +141,12 @@ public static SchemaImpl createInstance(AnnotationModel annotation, ApiContext c return from; } - // Solve the required attribute before "ref" as it is the only one which doesn't conflict with it. - final Boolean isRequired = annotation.getValue("required", Boolean.class); - if (isRequired != null) { - from.isRequired = isRequired; - } - String ref = annotation.getValue("ref", String.class); if (ref != null && !ref.isEmpty()) { from.setRef(ref); return from; } - + EnumModel typeEnum = annotation.getValue("type", EnumModel.class); if (typeEnum != null) { from.setType(SchemaType.valueOf(typeEnum.getValue())); @@ -184,6 +184,11 @@ public static SchemaImpl createInstance(AnnotationModel annotation, ApiContext c from.setMinProperties(annotation.getValue("minProperties", Integer.class)); from.setRequired(annotation.getValue("requiredProperties", List.class)); + final Boolean isRequired = annotation.getValue("required", Boolean.class); + if (isRequired != null) { + from.isRequired = isRequired; + } + extractAnnotations(annotation, context, "properties", "name", SchemaImpl::createInstance, from::addProperty); for (Entry property : from.getProperties().entrySet()) { final SchemaImpl propertySchema = (SchemaImpl) property.getValue(); @@ -920,7 +925,7 @@ private static void setImplementation(SchemaImpl schema, String implementationCl } else { schemaName = ModelUtils.getSimpleName(implementationClass); } - // Get the schema reference, and copy it's values over to the new schema model if they are missing + // Get the schema reference, and copy it's values over to the new schema model Schema copyFrom = context.getApi().getComponents().getSchemas().get(schemaName); if (copyFrom == null) { // If the class hasn't been parsed @@ -929,9 +934,9 @@ private static void setImplementation(SchemaImpl schema, String implementationCl } if (schema.getType() == SchemaType.ARRAY) { schema.setItems(new SchemaImpl()); - ModelUtils.merge(copyFrom, schema.getItems(), false); + ModelUtils.merge(copyFrom, schema.getItems(), true); } else { - ModelUtils.merge(copyFrom, schema, false); + ModelUtils.merge(copyFrom, schema, true); } schema.setRef(null); } diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/processor/ApplicationProcessor.java b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/processor/ApplicationProcessor.java index 6c4afddb5a4..d5b98bbb9b8 100644 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/processor/ApplicationProcessor.java +++ b/appserver/payara-appserver-modules/microprofile/openapi/src/main/java/fish/payara/microprofile/openapi/impl/processor/ApplicationProcessor.java @@ -39,6 +39,8 @@ */ package fish.payara.microprofile.openapi.impl.processor; +import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.isVoid; + import fish.payara.microprofile.openapi.api.processor.OASProcessor; import fish.payara.microprofile.openapi.api.visitor.ApiContext; import fish.payara.microprofile.openapi.api.visitor.ApiVisitor; @@ -61,7 +63,6 @@ import fish.payara.microprofile.openapi.impl.model.servers.ServerImpl; import fish.payara.microprofile.openapi.impl.model.tags.TagImpl; import fish.payara.microprofile.openapi.impl.model.util.ModelUtils; -import static fish.payara.microprofile.openapi.impl.model.util.ModelUtils.isVoid; import fish.payara.microprofile.openapi.impl.visitor.OpenApiWalker; import java.lang.reflect.Method; import java.util.ArrayList; @@ -69,12 +70,14 @@ import java.util.Collection; import java.util.Collections; import java.util.List; -import java.util.Map.Entry; import java.util.Set; -import java.util.logging.Level; +import java.util.Map.Entry; + import static java.util.logging.Level.FINE; import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.WARNING; + +import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import jakarta.ws.rs.DefaultValue; @@ -85,16 +88,16 @@ import org.eclipse.microprofile.openapi.models.Components; import org.eclipse.microprofile.openapi.models.ExternalDocumentation; import org.eclipse.microprofile.openapi.models.OpenAPI; -import org.eclipse.microprofile.openapi.models.Operation; import org.eclipse.microprofile.openapi.models.PathItem; import org.eclipse.microprofile.openapi.models.Reference; import org.eclipse.microprofile.openapi.models.callbacks.Callback; import org.eclipse.microprofile.openapi.models.media.MediaType; import org.eclipse.microprofile.openapi.models.media.Schema; -import org.eclipse.microprofile.openapi.models.media.Schema.SchemaType; import org.eclipse.microprofile.openapi.models.parameters.Parameter; import org.eclipse.microprofile.openapi.models.parameters.Parameter.In; import org.eclipse.microprofile.openapi.models.parameters.RequestBody; +import org.eclipse.microprofile.openapi.models.Operation; +import org.eclipse.microprofile.openapi.models.media.Schema.SchemaType; import org.eclipse.microprofile.openapi.models.responses.APIResponse; import org.eclipse.microprofile.openapi.models.responses.APIResponses; import org.eclipse.microprofile.openapi.models.security.SecurityRequirement; @@ -109,9 +112,9 @@ import org.glassfish.hk2.classmodel.reflect.FieldModel; import org.glassfish.hk2.classmodel.reflect.MethodModel; import org.glassfish.hk2.classmodel.reflect.ParameterizedInterfaceModel; -import org.glassfish.hk2.classmodel.reflect.ParameterizedType; import org.glassfish.hk2.classmodel.reflect.Type; import org.glassfish.hk2.classmodel.reflect.Types; +import org.glassfish.hk2.classmodel.reflect.ParameterizedType; /** * A processor to parse the application for annotations, to add to the OpenAPI @@ -630,7 +633,7 @@ private void visitSchemaField(AnnotationModel schemaAnnotation, FieldModel field visitSchemaFieldOrMethod(schemaAnnotation, field, declaringType, typeName, context); } - private void visitSchemaFieldOrMethod(AnnotationModel schemaAnnotation, AnnotatedElement fieldOrMethod, + public void visitSchemaFieldOrMethod(AnnotationModel schemaAnnotation, AnnotatedElement fieldOrMethod, ExtensibleType declaringType, String typeName, ApiContext context) { assert (fieldOrMethod instanceof FieldModel) || (fieldOrMethod instanceof MethodModel); @@ -1247,14 +1250,6 @@ private Schema createSchema( schema.setItems(null); } } - if (type instanceof AnnotatedElement) { - AnnotatedElement element = (AnnotatedElement) type; - final AnnotationModel schemaAnnotation = element - .getAnnotation(org.eclipse.microprofile.openapi.annotations.media.Schema.class.getName()); - if (schemaAnnotation != null) { - SchemaImpl.merge(SchemaImpl.createInstance(schemaAnnotation, context), schema, false, context); - } - } return schema; } diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/DependantClassesTest.java b/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/DependantClassesTest.java deleted file mode 100644 index 8f05b2b9ff1..00000000000 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/DependantClassesTest.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) [2021] Payara Foundation and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://github.com/payara/Payara/blob/master/LICENSE.txt - * See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at glassfish/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * The Payara Foundation designates this particular file as subject to the "Classpath" - * exception as provided by the Payara Foundation in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package fish.payara.microprofile.openapi.test.app.application; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.node.ObjectNode; -import fish.payara.microprofile.openapi.resource.rule.ApplicationProcessedDocument; -import fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest; -import fish.payara.microprofile.openapi.test.app.TestApplication; -import fish.payara.microprofile.openapi.test.app.application.schema.Schema1Depending; -import fish.payara.microprofile.openapi.test.app.application.schema.Schema2Simple; -import fish.payara.microprofile.openapi.test.app.application.schema.Schema2Simple1; -import static fish.payara.microprofile.openapi.test.util.JsonUtils.path; -import static fish.payara.microprofile.openapi.test.util.JsonUtils.toJson; -import java.util.Iterator; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import org.eclipse.microprofile.openapi.annotations.media.Content; -import org.eclipse.microprofile.openapi.annotations.media.Schema; -import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; -import org.eclipse.microprofile.openapi.annotations.responses.APIResponse; -import org.eclipse.microprofile.openapi.annotations.responses.APIResponses; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; - -/** - * Test presence of required attribute in the generated OpenApi. - */ -@Path("/serversDependant") -public class DependantClassesTest extends OpenApiApplicationTest { - - // add multiple classes to be processed, simulate component scan - @Before - @Override - public void createDocument() { - document = ApplicationProcessedDocument.createDocument(null, getClass(), TestApplication.class, Schema1Depending.class, Schema2Simple.class, Schema2Simple1.class); - jsonDocument = toJson(document); - } - - @POST - @Produces(MediaType.APPLICATION_JSON) - @APIResponses({ - @APIResponse(responseCode = "200", description = "Successful, returning ok.")}) - public Schema1Depending save(@RequestBody(description = "The request body with connected data", required = true, - content = @Content( - mediaType = MediaType.APPLICATION_JSON, - schema = @Schema(implementation = Schema1Depending.class) - )) Schema1Depending schema1Depending) { - return new Schema1Depending(); - } - - /** - * Test if the additional field description is copied to the dependant - * schema. E.g. Schema2Simple -> Schema1Depending - */ - @Test - public void dependantSchemaIsFullyPopulated() { - ObjectNode root = getOpenAPIJson(); - // verify schema - JsonNode subpropertyId = path(root, "components.schemas.Schema1Depending.properties.schema2Simple.properties.id"); - assertEquals("ID", subpropertyId.findValue("description").asText()); - assertEquals("1", subpropertyId.findValue("example").asText()); - // verify operation's data - // FIXME: this test crashes as for some reason, schema2Simple is refereneced, not copied. - JsonNode operationSubpropertyId = path(root, "paths./test/serversDependant.post.requestBody.content.application/json.schema.properties.schema2Simple.properties.id"); - assertEquals("ID", operationSubpropertyId.findValue("description").asText()); - assertEquals("1", operationSubpropertyId.findValue("example").asText()); - } - - @Test - public void dependantSchemaHasTwoRequiredFields() { - // verify, that both attributes in Schema1Depending (implementation and ref) are required - JsonNode requiredItems = path(getOpenAPIJson(), "components.schemas.Schema1Depending.required"); - assertNotNull(requiredItems); - Iterator requiredElements = requiredItems.elements(); - // verify one result - assertTrue(requiredElements.hasNext()); - // verify the name of the required field - assertEquals("schema2Simple", requiredElements.next().asText()); - // one more result - assertTrue(requiredElements.hasNext()); - // verify the name of the required field - assertEquals("schema2SimpleRef", requiredElements.next().asText()); - // no more than two results - assertFalse(requiredElements.hasNext()); - } -} diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/RequiredAttrTest.java b/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/RequiredAttrTest.java deleted file mode 100644 index 9e34d6178c8..00000000000 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/RequiredAttrTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) [2021] Payara Foundation and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://github.com/payara/Payara/blob/master/LICENSE.txt - * See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at glassfish/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * The Payara Foundation designates this particular file as subject to the "Classpath" - * exception as provided by the Payara Foundation in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package fish.payara.microprofile.openapi.test.app.application; - -import com.fasterxml.jackson.databind.JsonNode; -import fish.payara.microprofile.openapi.test.app.OpenApiApplicationTest; -import static fish.payara.microprofile.openapi.test.util.JsonUtils.path; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import org.eclipse.microprofile.openapi.annotations.media.Schema; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import org.junit.Test; - -/** - * Test presence of required attribute in the generated OpenApi. - */ -@Path("/serversReq") -public class RequiredAttrTest extends OpenApiApplicationTest { - - @Schema(name = "Server") - public class Server { - @Schema(name = "name", required = true) - private String name; - - public Server(String name) { - super(); - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } - - @GET - @Produces(MediaType.APPLICATION_JSON) - public List getServers() { - return Arrays.asList(new Server("Server A"), new Server("Server B")); - } - - @Test - public void requiredParameterIsPresent() { - JsonNode items = path(getOpenAPIJson(), "components.schemas.Server.required"); - assertNotNull(items); - Iterator requiredElements = items.elements(); - // verify one result - assertTrue(requiredElements.hasNext()); - // verify the name of the required field - assertEquals("name", requiredElements.next().asText()); - // no more than one result - assertFalse(requiredElements.hasNext()); - } -} diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema1Depending.java b/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema1Depending.java deleted file mode 100644 index d557777745f..00000000000 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema1Depending.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2021 Payara Foundation and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://github.com/payara/Payara/blob/master/LICENSE.txt - * See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at glassfish/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * The Payara Foundation designates this particular file as subject to the "Classpath" - * exception as provided by the Payara Foundation in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package fish.payara.microprofile.openapi.test.app.application.schema; - -import org.eclipse.microprofile.openapi.annotations.media.Schema; - -/** - * Class, which depends on Schema2Simple. "1" in the name ensures this class is - * processed BEFORE Schema2Simple. - * - * @author Petr Aubrecht - */ -@Schema(name = "Schema1Depending", description = "Schema1Depending data", implementation = Schema1Depending.class) -public class Schema1Depending { - - @Schema(name = "id", example = "1", description = "ID of the partner", implementation = Integer.class) - private Integer id; - - @Schema(name = "legal", example = "GmbH", description = "Legal of Company", enumeration = {"GmbH", "AG"}, implementation = String.class) - private String legal; - - @Schema(required = true, name = "schema2Simple", description = "Schema2Simple description GHANGED", implementation = Schema2Simple.class) - private Schema2Simple schema2Simple; - - @Schema(required = true, ref = "#/components/schemas/Schema2Simple") - private Schema2Simple schema2SimpleRef; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getLegal() { - return legal; - } - - public void setLegal(String legal) { - this.legal = legal; - } - - public Schema2Simple getSchema2SimpleRef() { - return schema2SimpleRef; - } - - public void setSchema2SimpleRef(Schema2Simple schema2SimpleRef) { - this.schema2SimpleRef = schema2SimpleRef; - } - - public Schema2Simple getSchema2Simple() { - return schema2Simple; - } - - public void setSchema2Simple(Schema2Simple schema2Simple) { - this.schema2Simple = schema2Simple; - } - -} diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple.java b/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple.java deleted file mode 100644 index 0ec72d7ff9d..00000000000 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2021 Payara Foundation and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://github.com/payara/Payara/blob/master/LICENSE.txt - * See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at glassfish/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * The Payara Foundation designates this particular file as subject to the "Classpath" - * exception as provided by the Payara Foundation in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package fish.payara.microprofile.openapi.test.app.application.schema; - -import org.eclipse.microprofile.openapi.annotations.media.Schema; - -/** - * Simple class, which doesn't depend on anything. - * - * @author Petr Aubrecht - */ -@Schema(name = "Schema2Simple", description = "Schema2Simple data", implementation = Schema2Simple.class) -public class Schema2Simple { - @Schema(required = true, example = "1", description = "ID", implementation = Integer.class) - private Integer id; - - @Schema(description = "dd", implementation = Schema2Simple1.class) - private Schema2Simple1 next1; - - @Schema(name = "attr1", example = "A", description = "Attr1 desc", enumeration = {"A", "B"}, implementation = String.class) - private String attr1; - - @Schema(name = "attr2", example = "-5", description = "Atrr2 desc", implementation = Integer.class) - private Integer attr2; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getAttr1() { - return attr1; - } - - public void setAttr1(String attr1) { - this.attr1 = attr1; - } - - public Integer getAttr2() { - return attr2; - } - - public void setAttr2(Integer attr2) { - this.attr2 = attr2; - } - - public Schema2Simple1 getNext1() { - return next1; - } - - public void setNext1(Schema2Simple1 next1) { - this.next1 = next1; - } - -} diff --git a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple1.java b/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple1.java deleted file mode 100644 index 91285cea6b0..00000000000 --- a/appserver/payara-appserver-modules/microprofile/openapi/src/test/java/fish/payara/microprofile/openapi/test/app/application/schema/Schema2Simple1.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2021 Payara Foundation and/or its affiliates. All rights reserved. - * - * The contents of this file are subject to the terms of either the GNU - * General Public License Version 2 only ("GPL") or the Common Development - * and Distribution License("CDDL") (collectively, the "License"). You - * may not use this file except in compliance with the License. You can - * obtain a copy of the License at - * https://github.com/payara/Payara/blob/master/LICENSE.txt - * See the License for the specific - * language governing permissions and limitations under the License. - * - * When distributing the software, include this License Header Notice in each - * file and include the License file at glassfish/legal/LICENSE.txt. - * - * GPL Classpath Exception: - * The Payara Foundation designates this particular file as subject to the "Classpath" - * exception as provided by the Payara Foundation in the GPL Version 2 section of the License - * file that accompanied this code. - * - * Modifications: - * If applicable, add the following below the License Header, with the fields - * enclosed by brackets [] replaced by your own identifying information: - * "Portions Copyright [year] [name of copyright owner]" - * - * Contributor(s): - * If you wish your version of this file to be governed by only the CDDL or - * only the GPL Version 2, indicate your decision by adding "[Contributor] - * elects to include this software in this distribution under the [CDDL or GPL - * Version 2] license." If you don't indicate a single choice of license, a - * recipient has the option to distribute your version of this file under - * either the CDDL, the GPL Version 2 or to extend the choice of license to - * its licensees as provided above. However, if you add GPL Version 2 code - * and therefore, elected the GPL Version 2 license, then the option applies - * only if the new code is made subject to such option by the copyright - * holder. - */ -package fish.payara.microprofile.openapi.test.app.application.schema; - -import org.eclipse.microprofile.openapi.annotations.media.Schema; - -/** - * Simple class, which doesn't depend on anything. - * - * @author Petr Aubrecht - */ -@Schema(name = "Schema2Simple1", description = "Schema2Simple1 data", implementation = Schema2Simple1.class) -public class Schema2Simple1 { - @Schema(required = true, example = "1", description = "ID", implementation = Integer.class) - private Integer id; - - @Schema(name = "salutation", example = "MR", description = "Salutation of the delivery address contact person", enumeration = {"MR", "MS"}, implementation = String.class) - private String salutation; - - @Schema(name = "quantity", example = "1", description = "Item quantity", implementation = Integer.class) - private Integer quantity; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getSalutation() { - return salutation; - } - - public void setSalutation(String salutation) { - this.salutation = salutation; - } - - public Integer getQuantity() { - return quantity; - } - - public void setQuantity(Integer quantity) { - this.quantity = quantity; - } - -}