Class AsyncAPIParser

java.lang.Object
ru.yojo.codegen.parser.AsyncAPIParser

public class AsyncAPIParser extends Object
Parses an AsyncAPI specification file and extracts all schemas, messages, and metadata needed for Java DTO generation.

Handles:

  • YAML loading and validation
  • components.schemas and components.messages extraction
  • Recursive external $ref resolution
  • Message resolution from channels (AsyncAPI 2.x) or operations (AsyncAPI 3.x)
  • YAML preprocessing for inline name/package injection
  • Constructor Details

    • AsyncAPIParser

      public AsyncAPIParser()
  • Method Details

    • parse

      public ParseResult parse(Path specFilePath, Path baseDir, String packageLocation) throws IOException
      Parses an AsyncAPI specification file and returns a structured result.
      Parameters:
      specFilePath - absolute path to the spec file
      baseDir - base directory for resolving relative $ref paths
      packageLocation - base package (e.g., "com.example")
      Returns:
      structured parse result
      Throws:
      IOException - if the spec file cannot be read
      IllegalArgumentException - if the file is not a root AsyncAPI/OpenAPI spec