Skip to content

Refactor of PostgresqlSchemaCodegen; generated output is unchanged - #25431

Open
ChihweiLHBird wants to merge 2 commits into
OpenAPITools:masterfrom
ChihweiLHBird:refactor/postgresql-schema-2-start-column
Open

ChihweiLHBird wants to merge 2 commits into
OpenAPITools:masterfrom
ChihweiLHBird:refactor/postgresql-schema-2-start-column

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

Summary

  • Drop locals the process*TypeProperty methods compute but never read.
  • Move the column prologue copied into all seven process*TypeProperty methods (column and table names, the x-postgresql-schema skip, the snake_case comment, the vendor-extension maps) into one private startColumn helper. Call order, log messages and public signatures are unchanged.

(One more step from #25382)

@mention the technical committee

PostgreSQL: @iri

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

processIntegerTypeProperty read dataType, isUuid and exclusiveMaximum,
processDecimalTypeProperty read dataType, dataFormat, exclusiveMinimum and
exclusiveMaximum and computed Float min/max bounds, processStringTypeProperty
read dataFormat and processBooleanTypeProperty allocated an argument list;
none of them was used afterwards.

No generated output changes.
All seven process*TypeProperty methods started with the same ~25 lines:
compute the column and table names, return early when the property already
carries x-postgresql-schema, record the original name in the column comment
when snake_case renamed it, and wire the vendor extension maps with
colName/colNameQuoted/tblName/tblNameQuoted.

Move that into a private startColumn helper that returns a ColumnContext
holding the two maps, the column name and the comment, or null when the
property was skipped. The order of toColumnName and toTableName (both can
log, and both run before the early return) and the snake_case check are
kept as they were; colNameQuoted/tblNameQuoted now store the boolean result
of isReservedWord directly instead of true/false literals in an if/else.

The public method signatures are unchanged. No generated output changes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

View guided diff | Re-trigger cubic

@ChihweiLHBird
ChihweiLHBird force-pushed the refactor/postgresql-schema-2-start-column branch from cc23074 to 4c2cde3 Compare October 26, 2026 15:59

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant