Search before asking
Paimon version
Tested on two versions:
Compute Engine
N/A
Minimal reproduce step
Errors can be reproduced using this setup (gradle project expected):
build.gradle.kts:
import org.gradle.api.tasks.SourceSetContainer
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id("java")
id("org.openapi.generator") version "7.14.0"
}
group = "openapi.generator.sample"
version = "0.1.0"
repositories {
mavenCentral()
}
dependencies {
implementation("org.apache.paimon:paimon-api:1.4.1")
}
val rootDir = rootProject.layout.projectDirectory
val specsDir = rootDir.dir("spec")
val paimonSpecDir = specsDir.dir("paimon")
val templatesDir = paimonSpecDir.dir("server-templates")
val generatedDir = layout.buildDirectory.dir("generated")
val generatedOpenApiSrcDir = layout.buildDirectory.dir("generated/src/main/java")
openApiGenerate {
inputSpec.set(paimonSpecDir.file("paimon-openapi-1.4.1.yaml").asFile.absolutePath)
generatorName.set("jaxrs-resteasy")
outputDir.set(generatedDir.get().asFile.absolutePath)
ignoreFileOverride.set(specsDir.file(".openapi-generator-ignore").asFile.absolutePath)
removeOperationIdPrefix.set(true)
templateDir.set(templatesDir.asFile.absolutePath)
globalProperties.put("apiDocs", "false")
globalProperties.put("models", "false")
globalProperties.put("apis", "")
globalProperties.put("modelTests", "false")
serverVariables.put("basePath", "api/catalog")
configOptions.put("resourceName", "catalog")
configOptions.put("useTags", "true")
configOptions.put("useBeanValidation", "false")
configOptions.put("sourceFolder", "src/main/java")
configOptions.put("useJakartaEe", "true")
configOptions.put("hideGenerationTimestamp", "true")
additionalProperties.put("apiNamePrefix", "PaimonRest")
additionalProperties.put("apiNameSuffix", "")
additionalProperties.put("apiPackage", "openapi.generated.paimon.api")
additionalProperties.put("dateLibrary", "java8")
modelNameMappings = mutableMapOf()
importMappings = mutableMapOf()
}
the<SourceSetContainer>().named("main") {
java.srcDir(layout.buildDirectory.dir("generated/src/gen/java"))
java.srcDir(generatedOpenApiSrcDir)
}
tasks.named<GenerateTask>("openApiGenerate") {
doLast {
delete(layout.buildDirectory.dir("generated/src/main/java/openapi/generated/paimon/api/impl"))
}
}
{projectRoot}/spec/paimon/paimon-openapi-1.4.1.yaml: content from https://github.com/apache/paimon/blob/release-1.4.1/docs/static/rest-catalog-open-api.yaml
Run:
./gradlew openApiGenerate
What doesn't meet your expectations?
Openapi generator fails with the next errors & warnings:
Execution failed for task ':openApiGenerate'.
> There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI).
| Error count: 32, Warning count: 3
Errors:
-components.responses.FunctionAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.TagAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/auth'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TableAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/TableAlreadyExistErrorResponse)
-components.responses.ViewAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-.components.responses.DatabaseNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/DatabaseNotExistErrorResponse)
-components.responses.BranchNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.FunctionNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/branches'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.FunctionAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/FunctionAlreadyExistErrorResponse)
-components.responses.DatabaseNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.SnapshotNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TagNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/TagNotExistErrorResponse)
-components.responses.TagNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.TableAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.BranchAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/tags'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.ViewNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/ViewNotExistErrorResponse)
-.components.responses.BranchNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/BranchNotExistErrorResponse)
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/snapshot'(get).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/snapshots/{version}'(get).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.ViewAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/ViewAlreadyExistErrorResponse)
-.components.responses.FunctionNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/FunctionNotExistErrorResponse)
-.components.responses.DatabaseAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/DatabaseAlreadyExistErrorResponse)
-components.responses.DatabaseAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.TableNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.For path parameter databaseNamePattern the required value should be true
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/rollback'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TagAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/TagAlreadyExistErrorResponse)
-components.responses.ViewNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.BranchAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/BranchAlreadyExistErrorResponse)
-.components.responses.TableNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/TableNotExistErrorResponse)
Warnings:
-components.responses.FunctionAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.TagAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/auth'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TableAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/TableAlreadyExistErrorResponse)
-components.responses.ViewAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-.components.responses.DatabaseNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/DatabaseNotExistErrorResponse)
-components.responses.BranchNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.FunctionNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/branches'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.FunctionAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/FunctionAlreadyExistErrorResponse)
-components.responses.DatabaseNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.SnapshotNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TagNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/TagNotExistErrorResponse)
-components.responses.TagNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-components.responses.TableAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.BranchAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/tags'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.ViewNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/ViewNotExistErrorResponse)
-.components.responses.BranchNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/BranchNotExistErrorResponse)
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/snapshot'(get).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/snapshots/{version}'(get).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.ViewAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/ViewAlreadyExistErrorResponse)
-.components.responses.FunctionNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/FunctionNotExistErrorResponse)
-.components.responses.DatabaseAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/DatabaseAlreadyExistErrorResponse)
-components.responses.DatabaseAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema
-components.responses.TableNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-paths.For path parameter databaseNamePattern the required value should be true
-paths.'/v1/{prefix}/databases/{database}/tables/{table}/rollback'(post).responses.404.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.TagAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/TagAlreadyExistErrorResponse)
-components.responses.ViewNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema
-.components.responses.BranchAlreadyExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceAlreadyExistErrorResponse is not of expected type Schema (#/components/responses/BranchAlreadyExistErrorResponse)
-.components.responses.TableNotExistErrorResponse.content.'application/json'.schema.$ref target #/components/responses/ResourceNotExistErrorResponse is not of expected type Schema (#/components/responses/TableNotExistErrorResponse)
Anything else?
Locally fixed those errors. Some examples:
// Seems as a typo for type: path <> query
// before:
- name: databaseNamePattern
description: A sql LIKE pattern (%) for database names. All databases will be returned if not set or empty. Currently, only prefix matching is supported.
in: path
schema:
type: string
// after:
- name: databaseNamePattern
description: A sql LIKE pattern (%) for database names. All databases will be returned if not set or empty. Currently, only prefix matching is supported.
in: query
schema:
type: string
// before
DatabaseAlreadyExistErrorResponse:
description: Conflict - The database already exists
content:
application/json:
schema:
$ref: '#/components/responses/ResourceAlreadyExistErrorResponse'
example:
{
"message": "The given database already exists",
"resourceType": "DATABASE",
"resourceName": "db",
"code": 409
}
// after
DatabaseAlreadyExistErrorResponse:
description: Conflict - The database already exists
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
example:
{
"message": "The given database already exists",
"resourceType": "DATABASE",
"resourceName": "db",
"code": 409
}
// before
"404":
description:
Not Found
- TableNotExistException, table does not exist
- SnapshotNotExistException, the requested snapshot does not exist
content:
application/json:
schema:
$ref: '#/components/responses/ResourceNotExistErrorResponse'
examples:
TableNotExist:
$ref: '#/components/examples/TableNotExistError'
SnapshotNotExist:
$ref: '#/components/examples/SnapshotNotExistError'
// after
"404":
description:
Not Found
- TableNotExistException, table does not exist
- SnapshotNotExistException, the requested snapshot does not exist
$ref: '#/components/responses/ResourceNotExistErrorResponse'
Are you willing to submit a PR?
Search before asking
Paimon version
Tested on two versions:
Compute Engine
N/A
Minimal reproduce step
Errors can be reproduced using this setup (gradle project expected):
build.gradle.kts:
{projectRoot}/spec/paimon/paimon-openapi-1.4.1.yaml: content from https://github.com/apache/paimon/blob/release-1.4.1/docs/static/rest-catalog-open-api.yaml
Run:
What doesn't meet your expectations?
Openapi generator fails with the next errors & warnings:
Anything else?
Locally fixed those errors. Some examples:
Are you willing to submit a PR?