Skip to content

feat: validate API auth type field with enum instead of bare string #136

Description

@rohilsurana

Problem

In `src/types/config.ts`, the API auth schema uses a bare string for the `type` field:

```ts
const apiAuthSchema = z.object({
type: z.string(), // no validation
header: z.string(),
placeholder: z.string().optional(),
})
```

Typos like `apikey` instead of `apiKey`, or `bearer-token` instead of `bearer`, only fail at runtime when the playground tries to construct auth headers.

Suggested Fix

```ts
const apiAuthSchema = z.object({
type: z.enum(['apiKey', 'bearer', 'basic']),
header: z.string(),
placeholder: z.string().optional(),
})
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions