apibconv

module
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2025 License: MIT

README

apibconv

CI codecov Go Reference Go Report Card Go Version Docker Image License

Convert between API Blueprint (*.apib), OpenAPI 2.0/3.0/3.1, and AsyncAPI 2.x/3.0 specifications.

Installation

Using Go

go install github.com/amer8/apibconv/cmd/apibconv@latest

Using Docker

Pull the image

docker pull ghcr.io/amer8/apibconv:latest

Run directly

docker run --rm -v $(pwd):/data -w /data ghcr.io/amer8/apibconv -o openapi.json api.apib

Download Binary

Download pre-built binaries from GitHub Releases:

Usage

CLI Usage

The tool automatically detects the input format based on file extension and content. It supports both file arguments and stdin.

Usage: apibconv [OPTIONS] [INPUT_FILE]

Arguments:
  INPUT_FILE
      Input specification file (OpenAPI, AsyncAPI, or API Blueprint)

Options:
  -o, --output FILE
      Output file path (required for conversion)
  
  --to FORMAT
      Target format: openapi, asyncapi, apib
      Auto-detected from --output extension if not specified
  
  -e, --encoding FORMAT
      Output encoding: json, yaml (default: auto-detected from output extension)
  
  --validate
      Validate input without converting
  
  -v, --version
      Print version information
  
  -h, --help
      Show this help message

AsyncAPI Options:
  --protocol PROTO
      Protocol: ws, wss, mqtt, kafka, amqp, http, https, auto (required)
  
  --asyncapi-version VERSION
      Version: 2.6, 3.0 (default: "2.6")

OpenAPI Options:
  --openapi-version VERSION
      Version: 3.0, 3.1 (default: "3.0")

Examples:
  apibconv -o output.json spec.apib
  apibconv -o output.yaml --protocol ws spec.apib
  apibconv -o output.json --to openapi --openapi-version 3.1 < spec.apib
  apibconv --validate spec.json

GitHub Actions

This tool is designed to integrate seamlessly into GitHub Actions workflows

- name: Convert OpenAPI to API Blueprint
  run: |
    go install github.com/amer8/apibconv@latest
    apibconv -o api-blueprint.apib openapi.json

Go projects

This tool is designed for seamless integration with servers and CLI tools built in Go.

Contributing

Contributions are welcome! Please ensure:

  1. All tests pass: go test ./...
  2. Linter passes: golangci-lint run
  3. Code coverage remains high

License

See LICENSE file for details.

Directories

Path Synopsis
cmd
apibconv command
Package main is the entry point for the apibconv command-line tool.
Package main is the entry point for the apibconv command-line tool.
examples
advanced command
Package main demonstrates advanced usage of the apibconv library, including custom transformations.
Package main demonstrates advanced usage of the apibconv library, including custom transformations.
basic command
Package main demonstrates basic usage of the apibconv library.
Package main demonstrates basic usage of the apibconv library.
plugin command
Package main demonstrates how to use custom plugins with apibconv.
Package main demonstrates how to use custom plugins with apibconv.
internal
cli
Package cli implements the command-line interface logic for apibconv.
Package cli implements the command-line interface logic for apibconv.
detect
Package detect provides functionality for detecting API specification formats.
Package detect provides functionality for detecting API specification formats.
fs
Package fs provides filesystem and I/O utility functions.
Package fs provides filesystem and I/O utility functions.
transform
Package transform provides utilities for modifying and normalizing API models.
Package transform provides utilities for modifying and normalizing API models.
pkg
converter
Package converter implements the core logic for converting between API formats.
Package converter implements the core logic for converting between API formats.
errors
Package errors defines standard error types used throughout the application.
Package errors defines standard error types used throughout the application.
format
Package format defines interfaces and common types for API format parsers and writers.
Package format defines interfaces and common types for API format parsers and writers.
format/apiblueprint
Package apiblueprint implements the API Blueprint format parser and writer.
Package apiblueprint implements the API Blueprint format parser and writer.
format/asyncapi
Package asyncapi implements the AsyncAPI format parser and writer.
Package asyncapi implements the AsyncAPI format parser and writer.
format/openapi
Package openapi implements the OpenAPI format parser and writer.
Package openapi implements the OpenAPI format parser and writer.
model
Package model defines the unified internal representation of API specifications.
Package model defines the unified internal representation of API specifications.
validator
Package validator provides rules and logic for validating API models.
Package validator provides rules and logic for validating API models.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL