Skip to content

WIP: refactor: extract shared path schemas to reduce duplication #2110

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

Open
wants to merge 1 commit into
base: support-remove-column-operation
Choose a base branch
from

Conversation

MH4GF
Copy link
Member

@MH4GF MH4GF commented Jun 20, 2025

This PR depends on #2109. Once #2109 is merged, this PR will be ready for review and the WIP prefix will be removed.

Issue

  • resolve: Extract duplicate path schemas in operation schema files

Why is this change needed?

Both column.ts and table.ts had duplicate path schema definitions that were used across multiple operation types. This refactoring extracts these schemas into shared constants to reduce code duplication and improve maintainability.

What would you like reviewers to focus on?

  • The extracted path schemas maintain the same functionality
  • All operation schemas correctly use the shared schemas
  • No breaking changes to existing type definitions

Testing Verification

  • All existing tests should continue to pass
  • Type definitions remain unchanged

What was done

🤖 Generated by PR Agent at 43fd249

• Extract duplicate path schemas into shared constants
• Reduce code duplication in column and table operation schemas
• Improve maintainability without functional changes

Detailed Changes

Relevant files
Enhancement
column.ts
Extract shared column path schema constant                             

frontend/packages/db-structure/src/operation/schema/column.ts

• Extract columnPathSchema constant from duplicate path validation

Replace inline path schemas in add/remove operations with shared
schema
• Maintain same validation logic and type definitions

+7/-8     
table.ts
Extract shared table path schema constant                               

frontend/packages/db-structure/src/operation/schema/table.ts

• Extract tablePathSchema constant from duplicate path validation

Replace inline path schemas in add/remove operations with shared
schema
• Maintain same validation logic and type definitions

+7/-8     

Additional Notes

This is a pure refactoring change with no functional modifications.

🤖 Generated with Claude Code


Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    changeset-bot bot commented Jun 20, 2025

    ⚠️ No Changeset found

    Latest commit: 43fd249

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets

    When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    Copy link

    vercel bot commented Jun 20, 2025

    The latest updates on your projects. Learn more about Vercel for Git ↗︎

    Name Status Preview Comments Updated (UTC)
    liam-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 8:04am
    liam-erd-sample ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 8:04am
    liam-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 8:04am
    1 Skipped Deployment
    Name Status Preview Comments Updated (UTC)
    liam-docs ⬜️ Ignored (Inspect) Visit Preview Jun 20, 2025 8:04am

    @MH4GF MH4GF changed the title refactor: extract shared path schemas to reduce duplication WIP: refactor: extract shared path schemas to reduce duplication Jun 20, 2025
    @MH4GF MH4GF marked this pull request as ready for review June 20, 2025 08:48
    @MH4GF MH4GF requested a review from a team as a code owner June 20, 2025 08:48
    @MH4GF MH4GF requested review from hoshinotsuyoshi, FunamaYukina, junkisai and NoritakaIkeda and removed request for a team June 20, 2025 08:48
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Schema Reuse

    The extracted columnPathSchema constant is only used twice within the same file. Consider if this level of extraction provides meaningful benefit over the original inline definitions, especially given the small scope of reuse.

    const columnPathSchema = v.custom<`/tables/${string}/columns/${string}`>(
      isColumnPath,
      'Path must match the pattern /tables/{tableName}/columns/{columnName}',
    )
    Schema Reuse

    Similar to the column schema, the tablePathSchema constant is only used twice within the same file. The refactoring may not provide significant maintainability benefits at this limited scope.

    const tablePathSchema = v.custom<`/tables/${string}`>(
      isTablePath,
      'Path must match the pattern /tables/{tableName}',
    )

    Copy link
    Contributor

    PR Code Suggestions ✨

    No code suggestions found for the PR.

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

    Successfully merging this pull request may close these issues.

    1 participant