oasdiff

command module
v0.1.19 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

codecov CircleCI

OpenAPI Spec Diff

A diff tool for OpenAPI Spec 3.

Unique features vs. other OAS3 diff tools

  • go module
  • deep diff into paths, parameters, responses, schemas, enums etc.

Build

git clone https://github.com/Tufin/oasdiff.git
cd oasdiff
go build

Running from the command-line

./oasdiff -base data/openapi-test1.yaml -revision data/openapi-test2.yaml

Help

./oasdiff --help

Embedding into your Go program

package main

import (
	"encoding/json"
	"fmt"

	log "github.com/sirupsen/logrus"

	"github.com/tufin/oasdiff/diff"
	"github.com/tufin/oasdiff/load"
)

func main() {
	loader := load.NewOASLoader()

	base, err := loader.From("https://raw.githubusercontent.com/Tufin/oasdiff/master/data/openapi-test1.yaml")
	if err != nil {
		return
	}

	revision, err := loader.From("https://raw.githubusercontent.com/Tufin/oasdiff/master/data/openapi-test2.yaml")
	if err != nil {
		return
	}

	bytes, err := json.MarshalIndent(diff.Get(base, revision, "", ""), "", " ")
	if err != nil {
		log.Errorf("failed to marshal result with '%v'", err)
		return
	}

	fmt.Printf("%s\n", bytes)
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package diff provides a diff function for OpenAPI Spec 3.
Package diff provides a diff function for OpenAPI Spec 3.

Jump to

Keyboard shortcuts

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