Skip to content

Incorporate OpenApi 3.1 YAML parser #1

@char0n

Description

@char0n

tree-sitter-yaml playground: https://ikatyang.github.io/tree-sitter-yaml/. There is also a GitHub repo that provides all prebuilt WASM binaries of all supported tree-sitter grammars.

Requirements:

  • integrate tree-sitter YAML grammar
  • create sensible YAML AST layer with Failsafe schema
  • use tree-sitter-yaml grammar to create YAML CST
  • write YAML CST -> YAML AST transformer
  • support for YAML Directives in YAML transformer
  • support for Errors
  • discarding all YAML documents except 1st one
  • support for comments within the YAML stream
  • support for Pairs without value
  • create YAML adapter for OpenApi 3.1.0
  • create YAML adapter for AsyncApi 2.0.0

Resources for understanding JSON vs YAML differences and YAML feature set:

Resources for creating sensible YAML AST


tree-sitter-yaml seems to have 2 issues

  1. extreme size of generated parser which results in extreme size of WASM. Compiled WASM is about 719,3 KiB (736 604 bytes)

  2. inability to be build functional WASM with tree-sitter-cli with versions higher than 0.16.5 (>=0.16.6).

These issues have been reported to YAML grammar author and other repos:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions