oav

command module
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

README

oav

oav is OpenAPI Validation tool.

inspired code: https://zenn.dev/podhmo/scraps/5dbfa70654f9f0

install

cli

go install github.com/kijimaD/oav@main

library

go get github.com/kijimaD/oav@main

Usage

import (
    "github.com/kijimaD/oav/oa"
)

func TestSchema() {}
	file, err := os.Open("openapi.yml")
	if err != nil {
		panic(err)
	}

	baseURL, err := url.Parse("http://localhost:8080") # serversに登録されているホスト名である必要がある
	if err != nil {
		panic(err)
	}

	c := oa.New(os.Stdout, file, *baseURL)
	err = c.Run("/pets", "GET", "{}", "", 200)
	if err != nil {
		log.Fatalf("!! %+v", err)
	}
	err = c.Run("/users", "GET", "{}", "", 200)
	if err != nil {
		log.Fatalf("!! %+v", err)
	}

command

dump schema routes.

docker-compose up -d
go run . openapi.yml

Endpoint        Method          ID
──────────      ──────────      ──────────
/pets           Get             list_pets

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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