Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL DDL code generation error - empty JSON property #46

Open
shoffmeister opened this issue Aug 28, 2024 · 1 comment
Open

SQL DDL code generation error - empty JSON property #46

shoffmeister opened this issue Aug 28, 2024 · 1 comment

Comments

@shoffmeister
Copy link

Given a specific (valid, albeit odd) JSON schema, kwack will generate invalid SQL, which will then lead to

java.lang.RuntimeException: Could not execute DDL: CREATE TABLE IF NOT EXISTS "my-topic" (rowkey VARCHAR NULL, "extensions" STRUCT() NOT NULL, rowinfo rowinfo)

Caused by: java.sql.SQLException: Parser Error: syntax error at or near ")"

In the SQL note the STRUCT() - this is triggered by an object without any properties.

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "extensions": {
      "$ref": "#/components/PersonSyncEventExtensions"
    }
  },
  "components": {
    "PersonSyncEventExtensions": {
      "type": "object"
    }
  }
}
@shoffmeister
Copy link
Author

That oddity is derived from a real-life, complex JSON schema (1500 lines of JSON) - so definitely a corner case, but also observed in the wild.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant