Class AsyncAPIInputProcessor

Class for processing AsyncAPI inputs

Hierarchy (view full)

Constructors

Properties

ANONYMOUS_MESSAGE_PREFIX: "<anonymous-message" = '<anonymous-message'
ANONYMOUS_PREFIX: "<anonymous" = '<anonymous'
MODELINA_INFERRED_NAME: string = 'x-modelgen-inferred-name'
supportedVersions: string[] = ...

Methods

  • Try to find the AsyncAPI version from the input. If it cannot undefined are returned, if it can, the version is returned.

    Parameters

    • Optional input: any

    Returns undefined | string

  • Reflect the name of the schema and save it to x-modelgen-inferred-name extension.

    This keeps the the id of the model deterministic if used in conjunction with other AsyncAPI tools such as the generator.

    Parameters

    • schema: boolean | SchemaInterface

      to reflect name for

    • alreadyIteratedSchemas: Map<string, AsyncapiV2Schema> = ...

      map of already processed schemas

    • Optional context: string | SchemaContext

      context information for name inference

    Returns boolean | AsyncapiV2Schema

  • Determine the best name for a schema based on available metadata and context.

    Priority order:

    1. Component schema key (from components/schemas)
    2. Schema title field
    3. Source file name (from custom resolver metadata)
    4. Message ID (for payloads)
    5. Context-based inference (property name, array item, enum)
    6. Inferred name parameter
    7. Fallback to sanitized anonymous ID

    Parameters

    • schemaId: undefined | string

      The schema ID from AsyncAPI parser

    • schemaJson: any

      The JSON representation of the schema

    • Optional context: SchemaContext

      Additional context for name inference

    • Optional inferredName: string

      Legacy inferred name parameter

    Returns string

    The determined schema name