You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
Here are some key observations to aid the review process:
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 No relevant tests
🔒 Security concerns
Sensitive information exposure: The custom fetch utility in 'dashboard/src/utils/hasura-api/custom-fetch.ts' allows passing an admin secret as a parameter. This could potentially expose sensitive information if not handled securely. Ensure that the admin secret is never exposed to client-side code and is properly protected in server-side implementations. Consider using environment variables or a secure secret management system to handle the admin secret.
The custom fetch utility allows passing an admin secret, which could be a security risk if not handled properly. Ensure that the admin secret is securely managed and not exposed to client-side code.
The generated API functions don't include explicit error handling. Consider adding try-catch blocks or error handling middleware to manage potential API errors gracefully.
The Orval configuration file sets up API generation. Ensure that all necessary options are correctly configured, especially the mutator and query settings, to match the project's requirements.
The 'down' property should be included in the 'required' array of the MigrationRequest schema. This ensures that users always provide a way to revert migrations, which is crucial for maintaining database integrity and allowing rollbacks.
MigrationRequest:
type: object
required:
- name
- up
+ - down
- datasource
properties:
name:
type: string
description: Name of the migration
example: my_migration
up:
type: array
- description: Steps to execute for the migration. Always provide a down migration as well when creating a migration that modifies the database+ description: Steps to execute for the migration
items:
$ref: '#/components/schemas/MigrationStep'
down:
type: array
- description: Steps to execute to revert the migration. Always provide this when creating a migration that modifies the database+ description: Steps to execute to revert the migration
items:
$ref: '#/components/schemas/MigrationStep'
datasource:
type: string
description: The data source to use
example: default
Suggestion importance[1-10]: 9
__
Why: Adding 'down' to the required fields is crucial for database integrity and rollback capability. This ensures that every migration has a defined reversion process, which is essential for maintaining a robust database schema management system.
High
Properly merge custom headers
The function is not using the headers object created earlier. Merge it with the existing headers in options to ensure all headers are properly set, including the admin secret if provided.
Why: The suggestion correctly identifies that the headers object is not being properly merged with options.headers. This fix ensures all headers, including the admin secret, are correctly set in the request.
Medium
Add error handling for fetch
Consider adding error handling for network failures or invalid responses. Wrap the fetch call in a try-catch block and handle potential errors to improve the robustness of the function.
Why: Adding error handling improves the function's robustness by catching and logging network errors or invalid responses. This enhancement is important for better error management and debugging.
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.
PR Type
Enhancement
Description
Generate Hasura API with Orval
Add custom fetch utility for API requests
Create type definitions for Hasura operations
Implement API endpoints for database operations
Changes walkthrough 📝
19 files
Implement custom fetch utility for API requests
Generate API client for Hasura operations
Define type for adding remote schema arguments
Define type for remote schema definition
Define type for remote schema header item
Define type for boolean expressions
Define type for bulk request operations
Define enum for bulk request types
Define type for bulk SQL operations
Define type for bulk SQL operation arguments
Define enum for bulk SQL operation types
Define type for column preset values
Define type for successful command responses
Define enum for command response result types
Define type for creating array relationship arguments
Define type for array relationship creation options
Define type for array relationship foreign key constraints
Define type for creating object relationship arguments
Define type for object relationship creation options
3 files
Configure Orval for Hasura API generation
Add ESLint configuration for generated files
Add Prettier configuration for generated files
1 files
Add Orval dependency and codegen script
1 files
Add OpenAPI specification for Hasura API
80 files