All Projects → Peltoche → Oaichecker

Peltoche / Oaichecker

Licence: apache-2.0
Test your OpenAPI specs and your server API at the same time

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Oaichecker

Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+63525%)
Mutual labels:  swagger, openapi
Swagger Core
Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
Stars: ✭ 6,898 (+57383.33%)
Mutual labels:  swagger, openapi
Angular Springboot Rest Jwt
Springboot, Angular and JWT security - Example Project based on Northwind Order Processing
Stars: ✭ 603 (+4925%)
Mutual labels:  swagger, openapi
Swagger Express Middleware
Swagger 2.0 middlware and mocks for Express.js
Stars: ✭ 543 (+4425%)
Mutual labels:  swagger, openapi
Schemathesis
A modern API testing tool for web applications built with Open API and GraphQL specifications.
Stars: ✭ 768 (+6300%)
Mutual labels:  swagger, openapi
Springfox
Automated JSON API documentation for API's built with Spring
Stars: ✭ 5,449 (+45308.33%)
Mutual labels:  swagger, openapi
Widdershins
OpenAPI / Swagger, AsyncAPI & Semoasa definitions to (re)Slate compatible markdown
Stars: ✭ 856 (+7033.33%)
Mutual labels:  swagger, openapi
Create Openapi Repo
🤖 Generator for GH repo to help you manage the OpenAPI definition lifecycle
Stars: ✭ 513 (+4175%)
Mutual labels:  swagger, openapi
Kin Openapi
OpenAPI 3.0 implementation for Go (parsing, converting, validation, and more)
Stars: ✭ 776 (+6366.67%)
Mutual labels:  swagger, openapi
Optic
Optic documents and tests your API as you build it
Stars: ✭ 760 (+6233.33%)
Mutual labels:  swagger, openapi
Django Ninja
💨 Fast, Async-ready, Openapi, type hints based framework for building APIs
Stars: ✭ 875 (+7191.67%)
Mutual labels:  swagger, openapi
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+6825%)
Mutual labels:  swagger, openapi
Generator Express No Stress
🚂 A Yeoman generator for Express.js based 12-factor apps and apis
Stars: ✭ 534 (+4350%)
Mutual labels:  swagger, openapi
Openapi Gui
GUI / visual editor for creating and editing OpenAPI / Swagger definitions
Stars: ✭ 891 (+7325%)
Mutual labels:  swagger, openapi
Oas Kit
Convert Swagger 2.0 definitions to OpenAPI 3.0 and resolve/validate/lint
Stars: ✭ 516 (+4200%)
Mutual labels:  swagger, openapi
Apicurio Studio
Open Source API Design
Stars: ✭ 638 (+5216.67%)
Mutual labels:  swagger, openapi
Swagger Parser
Swagger Spec to Java POJOs
Stars: ✭ 468 (+3800%)
Mutual labels:  swagger, openapi
Awesome Openapi3
😎 A list of awesome projects related to OpenAPI 3.0.x, curated by the community
Stars: ✭ 469 (+3808.33%)
Mutual labels:  swagger, openapi
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+5816.67%)
Mutual labels:  swagger, openapi
Oapi Codegen
Generate Go client and server boilerplate from OpenAPI 3 specifications
Stars: ✭ 806 (+6616.67%)
Mutual labels:  swagger, openapi

license Build Status GoDoc codecov GolangCI Go Report Card

OpenAPI Checker

Run you server tests and at the same time check if you tests match with you OpenAPI specs.

Why?

As a developper I often forget to change the specs after a server modification and so my API documentation is always deprecated after 2 commits. In order to fix that I have written a little lib which takes you tests HTTP request/responses an matches them against your API specs. If you request doesn't matchs the specs, you request will fail and so you test also fail.

How?

This lib permits you to generate an http.RoundTripper which can be easily integrated inside you http.Client from you already existing tests.

Example

import (
	"github.com/stretchr/testify/assert"
	"github.com/Peltoche/oaichecker"
)

var client http.Client

func init() {
	// Loads the specs file.
	//
	// It contains only a the specs for the endpoint 'GET /pets'.
	specs, err := oaichecker.NewSpecsFromFile("./dataset/petstore_minimal.json")
	if err != nil {
		panic(err)
	}

	// Create a client which the custom transport
	client = http.Client{
		Transport: oaichecker.NewTransport(specs),
	}
}

func Test_Posting_a_valid_pet(t *testing.T) {
	// Make the requests as usual.
	//
	// In this case the request is valid but the specs are not followed because
	// the endpoint 'POST /v2/pet' is not defined inside the specs, only 'GET /pets'.
	_, err := client.Post("http://petstore.swagger.io/v2/pet", "application/json", strings.NewReader(`{
	"name": "doggie",
	"photoUrls": ["some-url"]}`))

	// This assert should success but as the specs are not followed, `req` is
	// nil and `err` contains the following message:
	//
	// "Post http://petstore.swagger.io/v2/pet: operation not defined inside the specs"
	assert.NoError(t, err)
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].