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.
Add Native GraphQL Support to GoFr
Overview
This PR introduces native GraphQL support to GoFr with a code-first approach that eliminates the need for schema files or code generation. Developers can now build GraphQL APIs using the same familiar patterns as REST handlers, with automatic schema generation from Go types.
✨ Key Features
1. Code-First Philosophy
jsontags for field naming, maintaining consistency with REST APIs2. Developer Experience
*gofr.Context, providing seamless access to logger, databases, HTTP clients, etc./graphql/ui(auto-disabled in production)3. Architecture
/graphql(industry standard)gofrquery field provides health check via GraphQL4. Performance
🔧 API
Registration
Endpoints
POST /graphql- GraphQL endpoint (always available)GET /graphql/ui- Interactive Playground (disabled whenAPP_ENV=production)🧪 Testing
Integration Tests
examples/using-graphql/main_test.go🔒 Security
APP_ENV=production🎓 Example Usage
GraphQL Query:
Checklist:
goimportandgolangci-lint.Thank you for your contribution!