diff --git a/build.gradle b/build.gradle index f82f7ef7575c..f7ac51fc415f 100644 --- a/build.gradle +++ b/build.gradle @@ -41,6 +41,7 @@ buildscript { classpath 'com.palantir.gradle.revapi:gradle-revapi:1.7.0' classpath 'com.gorylenko.gradle-git-properties:gradle-git-properties:2.4.1' classpath 'com.palantir.gradle.gitversion:gradle-git-version:3.0.0' + classpath 'org.openapitools:openapi-generator-gradle-plugin:6.6.0' } } @@ -523,6 +524,13 @@ project(':iceberg-aws') { classpath = sourceSets.integration.runtimeClasspath jvmArgs += project.property('extraJvmArgs') } + + def s3SignerSpec = "$projectDir/src/main/resources/s3-signer-open-api.yaml" + tasks.register('validateS3SignerSpec', org.openapitools.generator.gradle.plugin.tasks.ValidateTask) { + inputSpec.set(s3SignerSpec) + recommend.set(true) + } + check.dependsOn('validateS3SignerSpec') } project(':iceberg-azure') { @@ -954,6 +962,15 @@ project(':iceberg-snowflake') { } } +project(':iceberg-open-api') { + def restCatalogSpec = "$projectDir/rest-catalog-open-api.yaml" + tasks.register('validateRESTCatalogSpec', org.openapitools.generator.gradle.plugin.tasks.ValidateTask) { + inputSpec.set(restCatalogSpec) + recommend.set(true) + } + check.dependsOn('validateRESTCatalogSpec') +} + @Memoized boolean versionFileExists() { return file('version.txt').exists() diff --git a/open-api/rest-catalog-open-api.py b/open-api/rest-catalog-open-api.py index cc70d6d4cd89..6225bf176929 100644 --- a/open-api/rest-catalog-open-api.py +++ b/open-api/rest-catalog-open-api.py @@ -419,7 +419,16 @@ class AssertDefaultSortOrderId(TableRequirement): class ViewRequirement(BaseModel): - __root__: Any = Field(..., discriminator='type') + type: str + + +class AssertViewUUID(ViewRequirement): + """ + The view UUID must match the requirement's `uuid` + """ + + type: Literal['assert-view-uuid'] + uuid: str class RegisterTableRequest(BaseModel): diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 0b008ace605d..473fa665a88a 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -2568,26 +2568,26 @@ components: propertyName: type mapping: assert-view-uuid: '#/components/schemas/AssertViewUUID' - type: object - required: - - type - properties: - type: - type: "string" + type: object + required: + - type + properties: + type: + type: "string" - AssertViewUUID: - allOf: - - $ref: "#/components/schemas/ViewRequirement" - description: The view UUID must match the requirement's `uuid` - required: - - type - - uuid - properties: - type: - type: string - enum: [ "assert-view-uuid" ] - uuid: - type: string + AssertViewUUID: + allOf: + - $ref: "#/components/schemas/ViewRequirement" + description: The view UUID must match the requirement's `uuid` + required: + - type + - uuid + properties: + type: + type: string + enum: [ "assert-view-uuid" ] + uuid: + type: string LoadTableResult: description: | @@ -3251,12 +3251,12 @@ components: application/json: schema: $ref: '#/components/schemas/IcebergErrorResponse' - example: { - "error": { - "message": "The server does not support this operation", - "type": "UnsupportedOperationException", - "code": 406 - } } + example: { + "error": { + "message": "The server does not support this operation", + "type": "UnsupportedOperationException", + "code": 406 + } } CreateNamespaceResponse: description: diff --git a/settings.gradle b/settings.gradle index d2c64da78a36..9a220f7b169d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -40,6 +40,7 @@ include 'gcp-bundle' include 'dell' include 'snowflake' include 'delta-lake' +include 'open-api' project(':api').name = 'iceberg-api' project(':common').name = 'iceberg-common' @@ -63,6 +64,7 @@ project(':gcp-bundle').name = 'iceberg-gcp-bundle' project(':dell').name = 'iceberg-dell' project(':snowflake').name = 'iceberg-snowflake' project(':delta-lake').name = 'iceberg-delta-lake' +project(':open-api').name = 'iceberg-open-api' if (null != System.getProperty("allVersions")) { System.setProperty("flinkVersions", System.getProperty("knownFlinkVersions"))