oas-expand

command
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2018 License: MIT Imports: 5 Imported by: 0

README

Expand

Expand is a CLI tool for expanding OAS files. It makes new specification file with all references expanded. Loading this new file is up to 100 times faster than loading regular (non-expanded) spec. So this may be used as a one-time action (for example on building docker image) to reduce time of all futher application starts.

Install

go get -u github.com/hypnoglow/oas2/cmd/oas-expand

Run to make specification file expanded

oas-expand -target-dir=./cache spec.yaml

Cache directory can be passed to oas loader using CacheDir parameter

doc, err := oas.LoadSpec(specPath, CacheDir("./cache"))

You can easily see the difference

now := time.Now()
oas.LoadSpec("./petstore.yaml")
log.Printf("Spec parsed in %s\n", time.Since(now))

now = time.Now()
oas.LoadSpec("./petstore.yaml", oas.CacheDir("./cache"))
log.Printf("Expanded spec parsed in %s\n", time.Since(now))
2018/02/13 18:47:08 Spec parsed in 1.224684788s
2018/02/13 18:47:08 Expanded spec parsed in 39.403587ms

Documentation

Overview

CLI utility that expands OAS file to reduce init time.

Jump to

Keyboard shortcuts

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