Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>OpenAPI Go DefinitionsNew to Visual Studio Code? Get it now.
OpenAPI Go Definitions

OpenAPI Go Definitions

Avital Tamir

|
2 installs
| (0) | Free
Jump to Go function definitions from OpenAPI operationId
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

OpenAPI Go Definitions

A VS Code extension that enables jump-to-definition from OpenAPI operationId fields to their corresponding Go function implementations.

Features

  • Jump to Definition: Ctrl/Cmd+Click on an operationId value in OpenAPI YAML or JSON files to navigate directly to the Go function definition
  • Workspace-wide Search: Automatically searches all Go files in your workspace
  • Configurable: Customize which Go files are searched using glob patterns

Usage

  1. Open an OpenAPI specification file (YAML or JSON)
  2. Find an operationId field, for example:
    paths:
      /workflow:
        post:
          operationId: invokeWorkflow
    
  3. Hold Ctrl (Windows/Linux) or Cmd (Mac) and click on invokeWorkflow
  4. The extension will jump to the Go function definition

Configuration

Configure the extension through VS Code settings:

  • openapi-go-definitions.goSourcePaths: Array of glob patterns for Go source files to search (default: ["**/*.go"])

Example settings.json:

{
  "openapi-go-definitions.goSourcePaths": [
    "internal/**/*.go",
    "pkg/**/*.go",
    "cmd/**/*.go"
  ]
}

Installation

From Source

  1. Clone this repository
  2. Run npm install
  3. Run npm run compile
  4. Press F5 to open a new VS Code window with the extension loaded

Package and Install

  1. Install vsce: npm install -g @vscode/vsce
  2. Package the extension: vsce package
  3. Install the .vsix file: code --install-extension openapi-go-definitions-0.0.1.vsix

Requirements

  • VS Code 1.80.0 or higher
  • Go source files in your workspace

How It Works

The extension:

  1. Detects when you click on an operationId value in YAML or JSON files
  2. Extracts the operation ID name
  3. Searches configured Go files for function definitions matching that name
  4. Provides the location for VS Code's "Go to Definition" feature

Supported Formats

YAML

operationId: functionName

JSON

"operationId": "functionName"

Limitations

  • Only searches for function definitions at the top level (not nested functions)
  • Requires exact name matching between operationId and Go function name
  • Does not support type aliases or indirect function references

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft