Skip to content

DjangoParser

reference
1 min readUpdated

Kind: Class

Source: atloria-monorepo/libs/parser-core/src/parsers/backend/django.parser.ts

Django REST Framework Parser implementation

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

  • DjangoParser stops the work with an early return when !fileContent.trim().
  • DjangoParser stops the work with an early return when !this.isDRFFile(fileContent).
  • DjangoParser stops the work with an early return when segments.length === 0.
  • DjangoParser stops the work with an early return when !assignment.
  • DjangoParser stops the work with an early return when close < 0.
  • DjangoParser stops the work with an early return when depth === 0.

When something fails

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

Was this page helpful?

Download as PDF