Skip to content

Conversation

@pengying
Copy link
Contributor

@pengying pengying commented Jan 24, 2026

Grid API SDK Configuration

  • Add .stainless/stainless.yml and workspace.json for SDK generation
  • Add AllErrors schema to properly handle error types
  • Replace Error schema references with GridError
  • Fix phone number format in UltimateBeneficialOwner to include '+' prefix
  • Update .redocly.lint-ignore.yaml with additional rule exceptions
  • Fix internal_accounts schema reference path

- Add .stainless/stainless.yml and workspace.json
- Add AllErrors schema and remove retry quotes endpoint
- Update .redocly.lint-ignore.yaml
- Fix UltimateBeneficialOwner phone format
- Fix internal_accounts ref path
@greptile-apps
Copy link

greptile-apps bot commented Jan 24, 2026

Greptile Overview

Greptile Summary

This PR adds Stainless SDK configuration to enable automated SDK generation for TypeScript and Kotlin clients, along with OpenAPI schema refinements to support proper error handling and fix existing schema issues.

Key Changes

  • SDK Configuration: Added .stainless/stainless.yml with comprehensive resource mappings, authentication setup, and error transformation rules. The config uses the AllErrors union schema with discriminator-based splitting to generate type-safe error handling in SDKs.

  • Error Schema Improvements:

    • Introduced AllErrors union schema that references all HTTP error variants (Error400 through Error501)
    • Renamed Error schema to GridError with additionalProperties: true on the details field
    • Consolidated duplicate GridError definition in bundled files
    • Updated error references in endpoint definitions
  • Schema Fixes:

    • Fixed internal_accounts.yaml reference path from non-existent users/InternalAccount.yaml to correct customers/InternalAccount.yaml
    • Corrected UltimateBeneficialOwner.yaml phone number example to include + prefix, matching the E.164 pattern requirement
  • Linting: Added exceptions to .redocly.lint-ignore.yaml for the AllErrors union schema and Quote discriminator properties

The changes properly integrate with Stainless's SDK generation workflow, which will transform the AllErrors union into distinct error types based on the code discriminator property.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it adds SDK tooling configuration and fixes schema inconsistencies without affecting runtime behavior
  • All changes are configuration and documentation-related with no runtime code changes. The Stainless SDK config follows best practices, schema fixes correct existing errors (wrong path reference, missing example prefix), and the error schema consolidation improves type safety. The bundled files were properly regenerated from source files.
  • No files require special attention - all changes are well-structured and follow OpenAPI best practices

Important Files Changed

Filename Overview
.stainless/stainless.yml New Stainless SDK config for TypeScript and Kotlin SDK generation with proper error handling setup
.stainless/workspace.json Stainless workspace config pointing to mintlify OpenAPI spec and TypeScript output path
openapi/components/schemas/customers/UltimateBeneficialOwner.yaml Fixed phone number example to include '+' prefix matching E.164 format pattern
openapi/openapi.yaml Added AllErrors union schema for Stainless SDK error transformation
openapi/paths/internal-accounts/internal_accounts.yaml Fixed InternalAccount schema path from non-existent users/ to correct customers/ directory

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Stainless as Stainless SDK Generator
    participant OAS as OpenAPI Spec (mintlify/openapi.yaml)
    participant Config as stainless.yml
    participant SDK as Generated SDK (TypeScript/Kotlin)

    Dev->>Config: Configure SDK targets & resources
    Dev->>OAS: Define AllErrors union schema
    Dev->>OAS: Update Error → GridError references
    Dev->>OAS: Fix schema paths & examples
    
    Note over Stainless,Config: SDK Generation Process
    
    Stainless->>Config: Read SDK configuration
    Config-->>Stainless: Resources, models, error handling config
    
    Stainless->>OAS: Parse OpenAPI specification
    OAS-->>Stainless: Schemas, paths, components
    
    Stainless->>Stainless: Transform AllErrors by enum property (code)
    Note over Stainless: Split error schemas into distinct types<br/>using discriminator pattern
    
    Stainless->>SDK: Generate TypeScript SDK
    Note over SDK: Package: grid<br/>Output: ../sdks/grid-typescript
    
    Stainless->>SDK: Generate Kotlin SDK
    Note over SDK: Package: com.grid.api<br/>Publish: false (maven)
    
    SDK-->>Dev: Type-safe SDKs with proper error handling
Loading

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