Skip to content

Commit

Permalink
use proper parent child delegation in OASFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
sboeckelmann committed May 7, 2024
1 parent 0bfaa0a commit 3dbf913
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ quarkus:
locales: en
default-locale: en-US
native:
# additional-build-args: "--trace-object-instantiation=java.security.SecureRandom,-H:+UnlockExperimentalVMOptions,--initialize-at-run-time=org.eclipse.persistence.sessions.coordination.DiscoveryManager\\,org.eclipse.persistence.eis.EISLogin\\,org.eclipse.persistence.asm.internal.platform.ow2.SerialVersionUIDAdderImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.ClassReaderImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.TypeImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.LabelImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.ClassWriterImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.AnnotationVisitorImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.FieldVisitorImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.MethodVisitorImpl\\,org.eclipse.persistence.eis.EISConnectionSpec\\,org.eclipse.persistence.eis.EISPlatform\\,org.eclipse.persistence.sessions.coordination.RemoteCommandManager\\,sun.rmi.transport.DGCImpl\\,org.eclipse.persistence.sessions.coordination.jms.JMSPublishingTransportManager\\,org.eclipse.persistence.internal.sessions.coordination.jms.JMSTopicRemoteConnection\\,io.openepcis.epc.converter.common.VersionTransformerProducer\\,org.apache.commons.math3.random.RandomDataGenerator\\,org.eclipse.persistence.sessions.coordination.broadcast.BroadcastTransportManager\\,io.openepcis.testdata.generator.format.RandomValueGenerator,-H:-LocalizationOptimizedMode,-Duser.country=US,-Duser.language=en,-H:IncludeLocales=en,-H:IncludeResourceBundles=jakarta.xml.bind.Messages,-H:ReflectionConfigurationFiles=reflection-config.json,-H:-UnlockExperimentalVMOptions"
# additional-build-args: "--trace-object-instantiation=java.security.SecureRandom,-H:+UnlockExperimentalVMOptions,--initialize-at-run-time=org.eclipse.persistence.sessions.coordination.DiscoveryManager\\,org.eclipse.persistence.eis.EISLogin\\,org.eclipse.persistence.asm.internal.platform.ow2.SerialVersionUIDAdderImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.ClassReaderImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.TypeImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.LabelImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.ClassWriterImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.AnnotationVisitorImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.FieldVisitorImpl\\,org.eclipse.persistence.asm.internal.platform.ow2.MethodVisitorImpl\\,org.eclipse.persistence.eis.EISConnectionSpec\\,org.eclipse.persistence.eis.EISPlatform\\,org.eclipse.persistence.sessions.coordination.RemoteCommandManager\\,sun.rmi.transport.DGCImpl\\,org.eclipse.persistence.sessions.coordination.jms.JMSPublishingTransportManager\\,org.eclipse.persistence.internal.sessions.coordination.jms.JMSTopicRemoteConnection\\,io.openepcis.epc.converter.common.VersionTransformerProducer\\,org.apache.commons.math3.random.RandomDataGenerator\\,org.eclipse.persistence.sessions.coordination.broadcast.BroadcastTransportManager\\,io.openepcis.testdata.generator.format.RandomValueGenerator,-H:-LocalizationOptimizedMode,-Duser.country=US,-Duser.language=en,-H:IncludeLocales=en,-H:IncludeResourceBundles=jakarta.xml.bind.Messages,-H:ReflectionConfigurationFiles=reflection-config.json,-H:-UnlockExperimentalVMOptions"
additional-build-args: "--trace-object-instantiation=java.security.SecureRandom,-H:+UnlockExperimentalVMOptions,--initialize-at-build-time=org.eclipse.persistence.jaxb,--initialize-at-build-time=org.eclipse.persistence.oxm,--initialize-at-run-time=io.openepcis.epc.converter.common.VersionTransformerProducer\\,org.apache.commons.math3.random.RandomDataGenerator\\,io.openepcis.testdata.generator.format.RandomValueGenerator,-H:-LocalizationOptimizedMode,-Duser.country=US,-Duser.language=en,-H:IncludeLocales=en,-H:IncludeResourceBundles=jakarta.xml.bind.Messages,-H:ReflectionConfigurationFiles=reflection-config.json,-H:-UnlockExperimentalVMOptions"
resources:
includes: static/**,static-web/**,jakarta/**/*.properties,**/jaxb.properties,META-INF/services/.*,META-INF/.*.kotlin_module$
Expand All @@ -26,6 +26,7 @@ quarkus:
package:
type: "uber-jar"


mp:
openapi:
filter: "io.openepcis.testdata.api.filter.SchemaExampleOASFilter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,28 @@
*/
package io.openepcis.testdata.api.filter;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.openepcis.resources.oas.EPCISExampleOASFilter;
import io.quarkus.runtime.annotations.RegisterForReflection;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

import lombok.extern.slf4j.Slf4j;
import org.eclipse.microprofile.openapi.OASFactory;
import org.eclipse.microprofile.openapi.OASFilter;
import org.eclipse.microprofile.openapi.models.Components;
import org.eclipse.microprofile.openapi.models.OpenAPI;
import org.eclipse.microprofile.openapi.models.examples.Example;

import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

@RegisterForReflection
@Slf4j
public class SchemaExampleOASFilter extends EPCISExampleOASFilter implements OASFilter {

private final ObjectMapper objectMapper = new ObjectMapper();

@Override
public void filterOpenAPI(OpenAPI openAPI) {
super.filterOpenAPI(openAPI);
try {
Components defaultComponents = OASFactory.createComponents();
if (openAPI.getComponents() == null) {
openAPI.setComponents(defaultComponents);
}

generateExamples().forEach(openAPI.getComponents()::addExample);
} catch (IOException e) {
log.error(e.getMessage(), e);
Expand Down

0 comments on commit 3dbf913

Please sign in to comment.