Kind: Class
Source: atloria-monorepo/apps/api-schema-parser/src/parsers/openapi.parser.ts
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
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 whenschema.type === 'array' && schema.items.OpenAPIParserstops the work with an early return when!schema.OpenAPIParserstops the work with an early return whenref.OpenAPIParserstops the work with an early return when!requestBody.
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?