parseOpenAPIDocument(_:diagnostics:)

Parses a YAML file as an OpenAPI document.

YamsParser.swift:51
static func parseOpenAPIDocument(_ input: InMemoryInputFile, diagnostics: any DiagnosticCollector) throws -> OpenAPIKit.OpenAPI.Document

Returns

Parsed OpenAPI document.

Throws

If the OpenAPI document cannot be parsed. Note that errors are also emited using the diagnostics collector.

This function supports documents following any of the following OpenAPI Specifications:

  • 3.0.0, 3.0.1, 3.0.2, 3.0.3

  • 3.1.0

  • Parameters

    • input: The file contents of the OpenAPI document.

    • diagnostics: A diagnostics collector used for emiting parsing warnings and errors.