# OpenAPIParser

**Kind:** Class

**Source:** [`atloria-monorepo/apps/api-schema-parser/src/parsers/openapi.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/api-schema-parser/src/parsers/openapi.parser.ts#L38)

OpenAPI Parser Implementation

Supports:
- OpenAPI 3.0.x and 3.1.x
- Swagger 2.0
- JSON and YAML formats

**Implements:** `IParser`

## Methods

| Method | Signature | Returns |
|---|---|---|
| `initialize` | `initialize(config: ParserConfig)` | `Promise<void>` |
| `canParse` | `canParse(filePath: string)` | `boolean` |
| `parseFile` | `parseFile(filePath: string, content: string)` | `Promise<ParseResult>` |
| `parseFiles` | `parseFiles(files: ParseFileInput[])` | `Promise<ParseResult[]>` |
| `destroy` | `destroy()` | `Promise<void>` |

## Properties

| Property | Type |
|---|---|
| `name` | `any` |
| `version` | `any` |
| `supportedPatterns` | `any` |

## Where it refuses work

- `OpenAPIParser` stops the work with an early return when `!pathItem`, in 4 places.
- `OpenAPIParser` stops the work with an early return when `!operation`, in 4 places.
- `OpenAPIParser` stops the work with an early return when `schema.type === 'array' && schema.items`.
- `OpenAPIParser` stops the work with an early return when `!schema`.
- `OpenAPIParser` stops the work with an early return when `ref`.
- `OpenAPIParser` stops the work with an early return when `!requestBody`.

## When something fails

- `OpenAPIParser` handles failure in 2 places: it logs it and continues in 1, and turns it into a return value in 1.
