{"record":{"id":"44722cbb948f0830","repo":"OpenAPITools/openapi-generator","slug":"empty-database-table-column-name-for-property-na","errorCode":null,"errorMessage":"Empty database/table/column name for property '{name}' not allowed","messagePattern":"Empty database/table/column name for property '(.+?)' not allowed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KtormSchemaCodegen.java","lineNumber":1079,"sourceCode":"     * @return identifier name\n     */\n    public String toIdentifier(String name, String prefix, String suffix) {\n        String escapedName = escapeQuotedIdentifier(name);\n        // Database, table, and column names cannot end with space characters.\n        if (escapedName.matches(\".*\\\\s$\")) {\n            LOGGER.warn(\"Database, table, and column names cannot end with space characters. Check '{}' name\", name);\n            escapedName = escapedName.replaceAll(\"\\\\s+$\", \"\");\n        }\n\n        // Identifiers may begin with a digit but unless quoted may not consist solely of digits.\n        if (escapedName.matches(\"^\\\\d+$\")) {\n            LOGGER.warn(\"Database, table, and column names cannot consist solely of digits. Check '{}' name\", name);\n            escapedName = prefix + escapedName + suffix;\n        }\n\n        // identifier name cannot be empty\n        if (escapedName.isEmpty()) {\n            throw new RuntimeException(\"Empty database/table/column name for property '\" + name + \"' not allowed\");\n        }\n        return escapedName;\n    }\n\n    /**\n     * Escapes identifier to use it in SQL statements with backticks, eg. SELECT \"identifier\" FROM\n     * Ref: https://www.sqlite.org/draft/tokenreq.html H41130\n     * Spec is similar to MySQL\n     *\n     * @param identifier source identifier\n     * @return escaped identifier\n     */\n    public String escapeQuotedIdentifier(String identifier) {\n        // ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) Extended: U+0080 .. U+FFFF\n        // ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers.\n        // This does in fact matches against >\\xFFFF and against ^\\x0000. works only on Java7+\n        Pattern regexp = Pattern.compile(\"[^0-9a-zA-z$_\\\\x0080-\\\\xFFFF]\");\n        Matcher matcher = regexp.matcher(identifier);","sourceCodeStart":1061,"sourceCodeEnd":1097,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KtormSchemaCodegen.java#L1061-L1097","documentation":"The Ktorm schema generator derives database/table/column names from OpenAPI identifiers and sanitizes them (stripping illegal characters, trailing whitespace, etc.). If sanitization reduces a name to the empty string, escapeDatabaseName throws 'Empty database/table/column name for property ... not allowed' (KtormSchemaCodegen.java:1079) because an identifier-less column cannot be emitted. Earlier conditions (trailing spaces, all-digit names) are only warned about and repaired; emptiness is fatal.","triggerScenarios":"A schema property, model, or vendor-extension table/column name whose characters are all stripped during escaping — e.g. a property named `###`, `$`, `***`, or one made solely of whitespace/punctuation — reaching escapeDatabaseName() during ktorm schema generation.","commonSituations":"Hand-edited specs with placeholder names; specs generated from external systems where a field's display name is pure symbols; rename scripts that mangle property keys; properties whose name consists only of characters illegal in SQL identifiers.","solutions":["Rename the offending property (the message includes the property name) to start with a letter or underscore and contain word characters.","Lint the spec for identifiers that contain no [A-Za-z0-9_] characters before generation.","If the symbolic name is mandated upstream, map it via a saner property name plus `x-` vendor extension or spec preprocessing."],"exampleFix":"# before (api.yaml)\ncomponents:\n  schemas:\n    Row:\n      properties:\n        \"###\": { type: string }\n# after\ncomponents:\n  schemas:\n    Row:\n      properties:\n        hash_prefix: { type: string }","handlingStrategy":"validation","validationCode":"// reject identifiers that sanitize to nothing before generation\nPattern wordChars = Pattern.compile(\"[^\\\\w]\");\nvoid checkIdentifiers(Map<String, Schema> props, String schemaName) {\n  for (String key : props.keySet()) {\n    if (wordChars.matcher(key).replaceAll(\"\").isEmpty()) {\n      throw new IllegalArgumentException(\n          \"Property '\" + key + \"' in '\" + schemaName + \"' has no valid identifier characters\");\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(clientOptInput).generate();\n} catch (RuntimeException e) {\n    // message contains the offending property name; rename it in the spec and retry\n    throw new BuildException(\"Ktorm schema generation failed: \" + e.getMessage(), e);\n}","preventionTips":["Require property keys to match ^[A-Za-z_][A-Za-z0-9_]*$ in spec lint.","Never use symbols-only placeholder names when editing specs by hand.","Sanity-check spreadsheet-to-OpenAPI exports for symbolic column headers."],"tags":["ktorm","database-schema","identifier","sanitization","openapi-spec","openapi-generator","spec-validation"],"backgroundTag":"empty-identifier-after-sanitization","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}