Skip to content

FastAPIParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/apps/backend-parser/src/parsers/fastapi.parser.ts

FastAPI Parser implementation

Uses regex-based parsing for Python files since we can't use Python AST directly in Node.js

Implements: IParser

Methods

MethodSignatureReturns
initializeinitialize(config: ParserConfig)Promise<void>
canParsecanParse(filePath: string)boolean
parseFileparseFile(filePath: string, content: string)Promise<ParseResult>
parseFilesparseFiles(files: ParseFileInput[])Promise<ParseResult[]>
destroydestroy()Promise<void>

Properties

PropertyType
nameany
versionany
supportedPatternsany

Where it refuses work

  • FastAPIParser stops the work with an early return when !fileContent.trim().
  • FastAPIParser stops the work with an early return when !this.isFastAPIFile(fileContent).

When something fails

  • FastAPIParser handles failure in 1 place: it turns it into a return value in all 1.

Was this page helpful?

Download as PDF