Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#983] feat(OpenAPI): add lint for OpenAPI (#1012)

mchades28dfefc3ff98
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index e4cd446680..7f5f2e3805 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -39,6 +39,7 @@ jobs:
- server-common/**
- trino-connector/**
- web/**
+ - docs/open-api/**
- build.gradle.kts
- gradle.properties
- gradlew
diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml
index 14697c8a97..ea59697c01 100644
--- a/.github/workflows/integration-test.yml
+++ b/.github/workflows/integration-test.yml
@@ -38,6 +38,7 @@ jobs:
- server-common/**
- trino-connector/**
- web/**
+ - docs/open-api/**
- build.gradle.kts
- gradle.properties
- gradlew
diff --git a/.gitignore b/.gitignore
index c9266269b6..2a01d181f8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,6 @@ docs/build
dev/docker/tools/docker-connector
include web/.gitignore
+
+# node env
+.node
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index aa2dd5f437..c58f6e9746 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -2,6 +2,8 @@
* Copyright 2023 Datastrato.
* This software is licensed under the Apache License version 2.
*/
+import com.github.gradle.node.NodeExtension
+import com.github.gradle.node.NodePlugin
import com.github.jk1.license.filter.DependencyFilter
import com.github.jk1.license.filter.LicenseBundleNormalizer
import com.github.jk1.license.render.InventoryHtmlReportRenderer
@@ -19,6 +21,7 @@ plugins {
id("idea")
id("jacoco")
alias(libs.plugins.gradle.extensions)
+ alias(libs.plugins.node) apply false
// Spotless version < 6.19.0 (https://github.com/diffplug/spotless/issues/1819) has an issue
// running against JDK21, but we cannot upgrade the spotless to 6.19.0 or later since it only
@@ -147,6 +150,17 @@ subprojects {
from(tasks["javadoc"])
}
+ if (project.name in listOf("web", "docs")) {
+ plugins.apply(NodePlugin::class)
+ configure<NodeExtension> {
+ version.set("20.9.0")
+ npmVersion.set("10.1.0")
+ yarnVersion.set("1.22.19")
+ nodeProjectDir.set(file("$rootDir/.node"))
+ download.set(true)
+ }
+ }
+
apply(plugin = "signing")
publishing {
publications {
diff --git a/docs/build.gradle.kts b/docs/build.gradle.kts
new file mode 100644
index 0000000000..349448a4f3
--- /dev/null
+++ b/docs/build.gradle.kts
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2023 Datastrato.
+ * This software is licensed under the Apache License version 2.
+ */
+
+import com.github.gradle.node.npm.task.NpxTask
+
+tasks {
+ val lintOpenAPI by registering(NpxTask::class) {
+ command.set("@redocly/[email protected]")
+ args.set(listOf("lint", "${project.projectDir}/open-api/openapi.yaml"))
+ }
+
+ build {
+ dependsOn(lintOpenAPI)
+ }
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index cab71baefc..669142c875 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -48,6 +48,7 @@ gradle-extensions-plugin = '1.74'
publish-plugin = '1.2.0'
rat-plugin = '0.8.0'
shadow-plugin = "8.1.1"
+node-plugin = "3.1.0"
[libraries]
protobuf-java = { group = "com.google.protobuf", name = "protobuf-java", version.ref = "protoc" }
@@ -148,3 +149,4 @@ gradle-extensions = { id = "com.github.vlsi.gradle-extensions", version.ref = "g
publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "publish-plugin" }
rat = { id = "org.nosphere.apache.rat", version.ref = "rat-plugin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow-plugin" }
+node = { id = "com.github.node-gradle.node", version.ref = "node-plugin" }
diff --git a/settings.gradle.kts b/settings.gradle.kts
index bd8fea613b..fcf709b218 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -13,3 +13,4 @@ include("catalogs:catalog-hive", "catalogs:catalog-lakehouse-iceberg", "catalogs
include("clients:client-java", "clients:client-java-runtime")
include("trino-connector")
include("web")
+include("docs")
diff --git a/web/build.gradle.kts b/web/build.gradle.kts
index 7e41c8bd23..df1d72cb5d 100644
--- a/web/build.gradle.kts
+++ b/web/build.gradle.kts
@@ -7,15 +7,10 @@ import com.github.gradle.node.yarn.task.YarnTask
plugins {
id("war")
- id("com.github.node-gradle.node") version "3.1.0"
}
-node {
- version = "20.9.0"
- npmVersion = "10.1.0"
- yarnVersion = "1.22.19"
- workDir = file("${project.projectDir}/.node")
- download = true
+tasks.withType(YarnTask::class) {
+ workingDir.set(file("${project.projectDir}"))
}
tasks {