Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

TL;DR

Added a new GridError schema and improved error handling in the OpenAPI specification.

What changed?

  • Created a new GridError schema to standardize error responses
  • Added additionalProperties: true to all error schema details objects to allow for flexible error details
  • Refactored BulkCustomerImportErrorEntry to extend from GridError instead of using a nested error structure
  • Updated webhook response schemas to reference GridError instead of Error

@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

This PR standardizes error handling across the Grid API by introducing a new GridError schema and enhancing flexibility in error responses.

Key Changes

  • New GridError schema: Created a reusable base error schema with code, message, and details fields at openapi/components/schemas/common/GridError.yaml
  • Flexible error details: Added additionalProperties: true to the details object in all HTTP error schemas (400, 401, 403, 404, 409, 412, 424, 500, 501), allowing APIs to include arbitrary metadata in error responses
  • Webhook error refactoring: Updated IncomingPaymentWebhookForbiddenResponse and IncomingPaymentWebhookUnprocessableResponse to extend from GridError instead of Error
  • Bulk import improvements: Created BulkCustomerImportErrorEntry schema that extends GridError and adds a correlationId field for tracking failed bulk import entries
  • Schema consolidation: Refactored BulkCustomerImportJob to reference the new BulkCustomerImportErrorEntry schema instead of defining error structure inline

Issues Found

  • Incomplete migration: openapi/paths/customers/customers_{customerId}.yaml:145 still references the old common/Error.yaml schema instead of the new GridError.yaml schema for the 410 response

Confidence Score: 4/5

  • This PR is mostly safe to merge but has one incomplete migration that should be addressed
  • The changes are well-structured and improve error handling standardization. However, the PR missed updating one reference from Error.yaml to GridError.yaml, creating an inconsistency. The old Error.yaml schema still exists and doesn't have additionalProperties: true, which means the 410 response won't benefit from flexible error details.
  • openapi/paths/customers/customers_{customerId}.yaml needs to be updated to complete the migration from Error to GridError

Important Files Changed

Filename Overview
openapi/components/schemas/common/GridError.yaml new standardized error schema with flexible additionalProperties: true on details object
openapi/components/schemas/customers/BulkCustomerImportErrorEntry.yaml extends GridError and adds correlationId field for bulk import error tracking
openapi/components/schemas/webhooks/IncomingPaymentWebhookForbiddenResponse.yaml updated to extend from GridError instead of Error
openapi/components/schemas/webhooks/IncomingPaymentWebhookUnprocessableResponse.yaml updated to extend from GridError instead of Error

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as Grid API
    participant Validator
    participant ErrorHandler
    
    Client->>API: API Request
    API->>Validator: Validate Request
    
    alt Invalid Request
        Validator->>ErrorHandler: Validation Failed
        ErrorHandler->>ErrorHandler: Create GridError with<br/>code, message, details
        ErrorHandler->>API: Return Error4XX
        API->>Client: GridError Response<br/>(additionalProperties: true)
    else Server Error
        API->>ErrorHandler: Internal Error
        ErrorHandler->>ErrorHandler: Create GridError with<br/>code, message, details
        ErrorHandler->>API: Return Error5XX
        API->>Client: GridError Response<br/>(additionalProperties: true)
    else Webhook Response
        API->>Client: Webhook Event
        Client->>Client: Process Webhook
        alt Forbidden
            Client->>API: GridError with reason<br/>(e.g., RESTRICTED_JURISDICTION)
        else Unprocessable
            Client->>API: GridError with requiredFields<br/>(missing counterparty info)
        else Success
            Client->>API: 200 OK
        end
    else Bulk Import Error
        API->>ErrorHandler: Import Entry Failed
        ErrorHandler->>ErrorHandler: Create BulkCustomerImportErrorEntry<br/>(extends GridError + correlationId)
        ErrorHandler->>API: Add to errors array
        API->>Client: BulkCustomerImportJob with errors[]
    end
Loading

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from 6432728 to e5749d2 Compare January 27, 2026 01:29
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Incomplete migration: still references Error.yaml instead of GridError.yaml. For consistency with the rest of this PR, this should be updated to use GridError.yaml.

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Incomplete migration: still references `Error.yaml` instead of `GridError.yaml`. For consistency with the rest of this PR, this should be updated to use `GridError.yaml`.

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 68ab09c to 5786fb9 Compare January 27, 2026 05:18
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from e5749d2 to a27f6e6 Compare January 27, 2026 05:19
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Inconsistent error schema reference - should use GridError.yaml instead of Error.yaml to match the PR's goal of standardizing on GridError

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Inconsistent error schema reference - should use `GridError.yaml` instead of `Error.yaml` to match the PR's goal of standardizing on `GridError`

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 5786fb9 to 79467e5 Compare January 27, 2026 05:24
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from a27f6e6 to a1379cd Compare January 27, 2026 05:24
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Update this to reference GridError for consistency with other error responses

            $ref: ../../components/schemas/common/GridError.yaml

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Update this to reference `GridError` for consistency with other error responses

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 79467e5 to 9f4bbd9 Compare January 27, 2026 20:38
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from a1379cd to d0f0475 Compare January 27, 2026 20:38
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
inconsistent reference - should use GridError instead of Error to match the pattern established in this PR

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
inconsistent reference - should use `GridError` instead of `Error` to match the pattern established in this PR

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from d0f0475 to 94a379a Compare January 27, 2026 21:19
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 9f4bbd9 to 4e17d69 Compare January 27, 2026 21:19
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 27, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
this should reference GridError.yaml not Error.yaml for consistency with the rest of the PR

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
this should reference `GridError.yaml` not `Error.yaml` for consistency with the rest of the PR

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 4e17d69 to 5022722 Compare January 27, 2026 23:54
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from 94a379a to c72b46f Compare January 27, 2026 23:54
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from c72b46f to 99a29c9 Compare January 27, 2026 23:57
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 5022722 to 03ebf04 Compare January 27, 2026 23:57
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
reference to Error.yaml should be updated to GridError.yaml for consistency

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
reference to `Error.yaml` should be updated to `GridError.yaml` for consistency

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from 99a29c9 to d8d7c4d Compare January 28, 2026 00:08
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 03ebf04 to db286da Compare January 28, 2026 00:08
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
Still references old Error.yaml instead of GridError.yaml

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
Still references old `Error.yaml` instead of `GridError.yaml`

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from db286da to 493e9f8 Compare January 28, 2026 00:15
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from d8d7c4d to 1c31c37 Compare January 28, 2026 00:15
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Additional Comments (1)

openapi/components/schemas/common/Error.yaml
Error schema's details field is missing additionalProperties: true while all other error schemas now have it

  details:
    type: object
    description: Additional error details
    additionalProperties: true
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/components/schemas/common/Error.yaml
Line: 9:11

Comment:
`Error` schema's `details` field is missing `additionalProperties: true` while all other error schemas now have it

```suggestion
  details:
    type: object
    description: Additional error details
    additionalProperties: true
```

How can I resolve this? If you propose a fix, please make it concise.

@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 493e9f8 to 34de965 Compare January 28, 2026 00:27
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from 1c31c37 to fbf418e Compare January 28, 2026 00:27
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split_split branch from fbf418e to 48e70c8 Compare January 28, 2026 04:32
@pengying pengying force-pushed the 01-24-feat_flatten_lightningexternalaccountinfo_schema_split_split_split branch from 34de965 to e2eb0c0 Compare January 28, 2026 04:32
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@greptile-apps
Copy link

greptile-apps bot commented Jan 28, 2026

Additional Comments (1)

openapi/paths/customers/customers_{customerId}.yaml
should reference GridError.yaml instead of Error.yaml to be consistent with the PR's goal of standardizing on GridError

            $ref: ../../components/schemas/common/GridError.yaml
Prompt To Fix With AI
This is a comment left during a code review.
Path: openapi/paths/customers/customers_{customerId}.yaml
Line: 145:145

Comment:
should reference `GridError.yaml` instead of `Error.yaml` to be consistent with the PR's goal of standardizing on `GridError`

```suggestion
            $ref: ../../components/schemas/common/GridError.yaml
```

How can I resolve this? If you propose a fix, please make it concise.

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.

2 participants