Navigator

May 29, 2026 · View on GitHub

Go Reference CI

Uniform OpenAPI file handling for the workspace toolchain. Navigator owns parsing, typed IR construction, pointers/ranges, multi-file $ref resolution, and parse-time validation for Swagger 2.0 and OpenAPI 3.0--3.2 documents.

Toolchain Role

Navigator is the canonical parse/index/ref layer in this workspace:

  • tree-sitter-openapi owns grammar and CST quality.
  • navigator owns parse/index/ref/validation contracts.
  • barrelman owns semantic/style/security rules and diagnostic packaging.
  • telescope owns editor and SDK experiences built on top of Navigator + Barrelman.

See TOOLCHAIN_BOUNDARIES.md for the cross-repo ownership model.

Installation

go get github.com/sailpoint-oss/navigator

Quick Start

Parse a Single File

import navigator "github.com/sailpoint-oss/navigator"

idx := navigator.Parse(content)
if idx == nil {
    log.Fatal("failed to parse")
}

for _, op := range idx.AllOperations() {
    fmt.Printf("%s %s  operationId=%s\n", op.Method, op.Path, op.Operation.OperationID)
}

Open a Multi-File Project

project, err := navigator.OpenProject("path/to/root.yaml")
if err != nil {
    log.Fatal(err)
}
project.LoadAll() // eagerly load all transitive $ref targets

result, err := project.Resolve(project.RootURI(), "./schemas/Pet.yaml")
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Resolved to %s (pointer: %s)\n", result.TargetURI, result.Pointer)

Full Workspace Graph (Shared Substrate)

import (
    navigator "github.com/sailpoint-oss/navigator"
    navgraph  "github.com/sailpoint-oss/navigator/graph"
)

ws := navigator.NewWorkspace()
g := navgraph.New(ws.Cache, ws.Graph)
g.AddSource(navigator.NewMemorySource(uri, content))

runner := navgraph.NewPipelineRunner(navgraph.DefaultStages()...) // raw -> parse -> bind
runner.RunAll(ctx, g, uri)

navigator/graph intentionally stops at the shared parse/bind substrate. Lint-rule execution and higher-level validate/analyze workflows are downstream concerns.

Design Principles

Lazy by default -- files are loaded and parsed only when needed. OpenProject loads the root document; transitive $ref targets load on demand. Project.LoadAll() is the explicit break-glass to force-load everything.

Break-glass at every level -- every abstraction exposes its internals. An Index provides Tree() for the raw tree-sitter CST, SemanticRoot() for the IR, and Document for the typed model. A Project exposes its Cache(), Graph(), and Resolver() for direct manipulation.

Workspace-wide shared state -- IndexCache and FileGraph are singletons shared across multiple roots. A Project is a thin lens over this shared state.

Package Layout

PackageImport PathDescription
Coregithub.com/sailpoint-oss/navigatorAll types, parsing, indexing, single-file and cross-file resolution, workspace infrastructure, and the project facade.
Graphgithub.com/sailpoint-oss/navigator/graphShared workspace graph substrate with built-in raw, parse, and bind stages used by downstream orchestrators.

Core Package Highlights

AreaKey Types / Functions
ParsingParse, ParseURI (standalone, no CGO) / ParseContent, ParseTree (tree-sitter)
Document ModelDocument, PathItem, Operation, Schema, Components, Parameter, Response
IndexingIndex, PointerIndex, IndexCache
ResolutionResolveRef (local), CrossFileResolver (cross-file)
WorkspaceProject, Workspace, FileGraph, Discovery
SourcesDocumentSource, FilesystemSource, MemorySource
LocationsLoc, Range, Position, SemanticNode

Tree-sitter vs Standalone Parsing

Navigator provides two parsing paths:

Standalone (Parse / ParseURI)Tree-sitter (ParseContent / ParseTree)
CGO requiredNoYes
Source locationsApproximate (yaml.v3 line/column)Precise (tree-sitter byte offsets)
idx.Tree()nil*tree_sitter.Tree
idx.SemanticRoot()nil*SemanticNode
Best forCLI tools, CI, contract testingLSP, linting with precise diagnostics

Both parsers produce logically equivalent *Index output. The same operations, schemas, refs, and document structure are present regardless of parser.

Dependencies

DependencyPurpose
tree-sitter-openapiTree-sitter grammar for OpenAPI YAML/JSON
go-tree-sitterTree-sitter Go runtime
fsnotifyFilesystem watching
yaml.v3Standalone YAML parsing (no CGO)

Releasing

Navigator uses Go module versioning, but the repository's current release workflow is automated:

  • .github/workflows/release.yml runs on pushes to main.
  • It bumps the next patch tag automatically and creates the GitHub Release.
  • For compatibility-sensitive changes, run the Downstream Smoke workflow first and verify the anchors listed in TOOLCHAIN_FIXTURE_MATRIX.md.

Release coordination guidance lives in:

  • TOOLCHAIN_BOUNDARIES.md for ownership, bump order, and smoke checks
  • TOOLCHAIN_FIXTURE_MATRIX.md for the cross-repo parity matrix

The Go module proxy automatically indexes published tags after the release workflow pushes them.

This repo is part of a six-repo OpenAPI toolchain:

  • tree-sitter-openapi — grammar and tree-sitter bindings
  • barrelman — generic OpenAPI lint rules and plug-in surface
  • cartographer — source-to-OpenAPI extractor for Go, Java, TypeScript, Python, C#
  • telescope — VS Code extension, language server, and CLI built on the above
  • barometer — live HTTP contract testing and Arazzo runner

License

See LICENSE for details.