Kind: Class
Source: atloria-monorepo/libs/parser-core/src/parsers/api-schema/openapi.parser.ts
OpenAPI Parser Implementation (Parser-Core Version)
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
OpenAPIParserstops the work with an early return when!pathItem, in 4 places.OpenAPIParserstops the work with an early return when!operation, in 4 places.OpenAPIParserstops the work with an early return when!/\.(json|ya?ml)$/i.test(filePath).OpenAPIParserstops the work with an early return whenschema === null || typeof schema !== 'object'.OpenAPIParserstops the work with an early return whenancestors.includes(schema as object).OpenAPIParserstops the work with an early return whenArray.isArray(schema).
When something fails
OpenAPIParserhandles failure in 2 places: it logs it and continues in 1, and turns it into a return value in 1.
Was this page helpful?