Skip to content

feat: add integrations config to site schema #240

@perasperaactual

Description

@perasperaactual

Overview

Add integrations section to site config schema to support pro package integrations (OpenAPI, GraphQL, etc.).

Motivation

The prebuild plugin system is now in place (PR #237). We need to validate integration configs in stackwright.yml so users get helpful errors instead of silent failures.

Acceptance Criteria

  • Add integrations field to siteConfigSchema in @stackwright/types
  • Schema accepts array of integration objects with type, name, and additional properties
  • Integration type is validated (e.g., openapi, graphql, rest)
  • Validation errors are helpful for users
  • Add tests for integration config validation

Implementation Details

1. Add integration schema to types package

File: packages/types/src/schemas/site-config.ts

import { z } from 'zod';

// Integration base schema
const integrationBaseSchema = z.object({
  type: z.enum(['openapi', 'graphql', 'rest']),
  name: z.string().min(1, 'Integration name is required'),
}).passthrough(); // Allow additional properties for integration-specific config

// Add to siteConfigSchema:
export const siteConfigSchema = z.object({
  theme: themeSchema,
  appBar: appBarSchema.optional(),
  footer: footerSchema.optional(),
  integrations: z.array(integrationBaseSchema).optional(),
  // ... rest of schema
});

2. Add TypeScript types

File: packages/types/src/types/site-config.ts

export interface IntegrationConfig {
  type: 'openapi' | 'graphql' | 'rest';
  name: string;
  [key: string]: unknown; // Additional integration-specific properties
}

export interface SiteConfig {
  theme: ThemeConfig;
  appBar?: AppBarConfig;
  footer?: FooterConfig;
  integrations?: IntegrationConfig[];
  // ... rest of interface
}

3. Add tests

File: packages/types/test/site-config.test.ts

Test cases for valid integrations, invalid types, missing names, and additional properties.

Files to Modify

  • packages/types/src/schemas/site-config.ts
  • packages/types/src/types/site-config.ts
  • packages/types/test/site-config.test.ts

Related

  • Foundation for @stackwright-pro/openapi integration
  • Enables future integration types (GraphQL, REST, CMS, etc.)

Estimated Time

1-2 hours

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions