Add configurable suffixes for GraphQL naming#41
Open
dmythro wants to merge 1 commit intodrizzle-team:mainfrom
Open
Add configurable suffixes for GraphQL naming#41dmythro wants to merge 1 commit intodrizzle-team:mainfrom
dmythro wants to merge 1 commit intodrizzle-team:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds configurable suffixes for GraphQL naming to allow customization of query field names without breaking existing code. It maintains backward compatibility by keeping the default suffixes as an empty string for list queries and "Single" for single entity queries.
- Adds
suffixesconfiguration option toBuildSchemaConfigtype with optionallistandsingleproperties - Implements suffix validation to prevent conflicts when both suffixes are identical
- Updates all database builders (SQLite, PostgreSQL, MySQL) to use configurable suffixes
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Adds new suffixes configuration option to BuildSchemaConfig type |
| src/index.ts | Implements suffix defaults, validation logic, and passes suffixes to generators |
| src/util/builders/sqlite.ts | Updates select functions to accept and use configurable suffixes |
| src/util/builders/pg.ts | Updates select functions to accept and use configurable suffixes |
| src/util/builders/mysql.ts | Updates select functions to accept and use configurable suffixes |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Mainly, wanted to add customizable naming to GraphQL schema and don't break existing code, so single entity suffix is still "Single", list suffix is "" by default.
My projects use singular naming for entities (eg "user", "account"), so naturally I'd like to see suffixes like this as default behavior is a bit confusing: