# OpenAPI Parser

This directory contains the OpenAPI parsing logic ported from Hoppscotch.

## Structure

- `index.ts` - Main importer function
- `validator.ts` - OpenAPI validation logic
- `dereferencer.ts` - Reference resolution
- `transformer.ts` - OpenAPI → BrainfishCollection conversion
- `parsers/` - Version-specific parsers (v2, v3, v31)
- `extractors/` - Extraction functions (auth, params, headers, body, responses)
- `example-generators/` - Example generation from schemas

## Dependencies Required

Before implementing, install these dependencies:

```bash
npm install @apidevtools/swagger-parser openapi-types js-yaml lodash-es
npm install -D @types/js-yaml @types/lodash-es
```

## Porting Strategy

1. Copy functions from Hoppscotch's `openapi/index.ts`
2. Replace `HoppCollection` → `BrainfishCollection`
3. Replace `HoppRESTRequest` → `BrainfishRESTRequest`
4. Replace `makeCollection` → `makeBrainfishCollection`
5. Replace `makeRESTRequest` → `makeBrainfishRESTRequest`
6. Convert fp-ts to native TypeScript (optional)
7. Convert Web Worker to Next.js API route or direct function calls
