# YamlParser

**Kind:** Class

**Source:** [`atloria-monorepo/apps/config-docs-parser/src/parsers/yaml.parser.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/config-docs-parser/src/parsers/yaml.parser.ts#L81)

**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

- `YamlParser` stops the work with `Error` when `!content` — “Content is required for parsing”.
- `YamlParser` stops the work with an early return when `fileName.includes('docker-compose') || fileName.includes('compose.y')`.
- `YamlParser` stops the work with an early return when `firstDoc.services || firstDoc.version`.
- `YamlParser` stops the work with an early return when `fileName.includes('.github/workflows/') || fileName.includes('/.github/workflows/')`.
- `YamlParser` stops the work with an early return when `firstDoc.on && firstDoc.jobs`.
- `YamlParser` stops the work with an early return when `fileName.includes('.gitlab-ci')`.

## When something fails

- `YamlParser` handles failure in 1 place: it turns it into a return value in all 1.
