From a395bd29d2f17a90ca8902b3a9cb6c98104fe34e Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Tue, 27 Aug 2024 10:57:53 -0400 Subject: [PATCH] REF: data prepper plugin schema (#4872) Signed-off-by: George Chen --- data-prepper-plugin-schema-cli/build.gradle | 2 +- data-prepper-plugin-schema/build.gradle | 35 +++++++++++++++++++ .../schemas/JsonSchemaConverter.java | 0 .../PluginConfigsJsonSchemaConverter.java | 0 .../schemas/module/CustomJacksonModule.java | 0 .../schemas/JsonSchemaConverterTest.java | 0 .../PluginConfigsJsonSchemaConverterIT.java | 0 .../PluginConfigsJsonSchemaConverterTest.java | 0 settings.gradle | 4 ++- 9 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 data-prepper-plugin-schema/build.gradle rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/main/java/org/opensearch/dataprepper/schemas/JsonSchemaConverter.java (100%) rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java (100%) rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/main/java/org/opensearch/dataprepper/schemas/module/CustomJacksonModule.java (100%) rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/test/java/org/opensearch/dataprepper/schemas/JsonSchemaConverterTest.java (100%) rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterIT.java (100%) rename {data-prepper-plugin-schema-cli => data-prepper-plugin-schema}/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java (100%) diff --git a/data-prepper-plugin-schema-cli/build.gradle b/data-prepper-plugin-schema-cli/build.gradle index 2108fad681..fdcf46cf92 100644 --- a/data-prepper-plugin-schema-cli/build.gradle +++ b/data-prepper-plugin-schema-cli/build.gradle @@ -9,7 +9,7 @@ application { dependencies { implementation project(':data-prepper-plugins') - implementation project(':data-prepper-plugin-framework') + implementation project(':data-prepper-plugin-schema') implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'org.reflections:reflections:0.10.2' implementation 'com.github.victools:jsonschema-maven-plugin:4.35.0' diff --git a/data-prepper-plugin-schema/build.gradle b/data-prepper-plugin-schema/build.gradle new file mode 100644 index 0000000000..bea3f0f778 --- /dev/null +++ b/data-prepper-plugin-schema/build.gradle @@ -0,0 +1,35 @@ +plugins { + id 'data-prepper.publish' +} + +dependencies { + implementation project(':data-prepper-api') + implementation project(':data-prepper-plugin-framework') + implementation 'com.fasterxml.jackson.core:jackson-databind' + implementation 'org.reflections:reflections:0.10.2' + implementation 'com.github.victools:jsonschema-maven-plugin:4.35.0' + implementation 'com.github.victools:jsonschema-generator:4.35.0' + implementation 'com.github.victools:jsonschema-module-jackson:4.35.0' + implementation 'com.github.victools:jsonschema-module-jakarta-validation:4.35.0' + implementation 'javax.inject:javax.inject:1' + implementation(libs.spring.core) { + exclude group: 'commons-logging', module: 'commons-logging' + } + implementation(libs.spring.context) { + exclude group: 'commons-logging', module: 'commons-logging' + } + testImplementation(platform("org.junit:junit-bom:5.9.1")) + testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation project(':data-prepper-plugins') +} + +jacocoTestCoverageVerification { + dependsOn jacocoTestReport + violationRules { + rule { //in addition to core projects rule + limit { + minimum = 0.90 + } + } + } +} \ No newline at end of file diff --git a/data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/JsonSchemaConverter.java b/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/JsonSchemaConverter.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/JsonSchemaConverter.java rename to data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/JsonSchemaConverter.java diff --git a/data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java b/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java rename to data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverter.java diff --git a/data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/module/CustomJacksonModule.java b/data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/module/CustomJacksonModule.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/main/java/org/opensearch/dataprepper/schemas/module/CustomJacksonModule.java rename to data-prepper-plugin-schema/src/main/java/org/opensearch/dataprepper/schemas/module/CustomJacksonModule.java diff --git a/data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/JsonSchemaConverterTest.java b/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/JsonSchemaConverterTest.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/JsonSchemaConverterTest.java rename to data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/JsonSchemaConverterTest.java diff --git a/data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterIT.java b/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterIT.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterIT.java rename to data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterIT.java diff --git a/data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java b/data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java similarity index 100% rename from data-prepper-plugin-schema-cli/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java rename to data-prepper-plugin-schema/src/test/java/org/opensearch/dataprepper/schemas/PluginConfigsJsonSchemaConverterTest.java diff --git a/settings.gradle b/settings.gradle index 3524edaee3..97742e8576 100644 --- a/settings.gradle +++ b/settings.gradle @@ -181,4 +181,6 @@ include 'data-prepper-plugins:rds-source' include 'data-prepper-plugins:http-source-common' include 'data-prepper-plugins:http-common' include 'data-prepper-plugins:aws-lambda' -//include 'data-prepper-plugins:dummy-plugin' \ No newline at end of file +//include 'data-prepper-plugins:dummy-plugin' +include 'data-prepper-plugin-schema' +