OpenAPI specification object model

OpenAPI

build-img pkg-img reportcard-img coverage-img version-img

OpenAPI specification object model

Features

  • Easy to integrate.

Installation

go get github.com/neotoolkit/openapi

Usage

package main

import (
	"fmt"
	"io/ioutil"
	"log"

	"github.com/neotoolkit/openapi"
)

func main() {
	file, err := ioutil.ReadFile("openapi.yml")
	if err != nil {
		log.Fatalln(err)
	}

	oapi, err := openapi.Parse(file)
	if err != nil {
		log.Fatalln(err)
	}
	
	fmt.Println(oapi.OpenAPI)
}

Documentation

See these docs.

License

MIT License.

Sponsors

Sponsored by Evrone

Comments
  • chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0

    chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.0

    Bumps github.com/stretchr/testify from 1.7.5 to 1.8.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.4

    chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.4

    Bumps github.com/stretchr/testify from 1.7.1 to 1.7.4.

    Commits
    • 48391ba Fix panic in AssertExpectations for mocks without expectations (#1207)
    • 840cb80 arrays value types in a zero-initialized state are considered empty (#1126)
    • 07dc7ee Bump actions/setup-go from 3.1.0 to 3.2.0 (#1191)
    • c33fc8d Bump actions/checkout from 2 to 3 (#1163)
    • 3c33e07 Added Go 1.18.1 as a build/supported version (#1182)
    • e2b56b3 Bump github.com/stretchr/objx from 0.1.0 to 0.4.0
    • 41453c0 Update gopkg.in/yaml.v3
    • 285adcc Update go versions in build matrix
    • 6e7fab4 Bump actions/setup-go from 2 to 3.1.0
    • 106ec21 use RWMutex
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2

    chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2

    Bumps github.com/stretchr/testify from 1.7.1 to 1.7.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2

    chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.2

    Bumps github.com/stretchr/testify from 1.7.1 to 1.7.2.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1

    chore(deps): bump github.com/stretchr/testify from 1.7.0 to 1.7.1

    Bumps github.com/stretchr/testify from 1.7.0 to 1.7.1.

    Commits
    • 083ff1c Fixed didPanic to now detect panic(nil).
    • 1e36bfe Use cross Go version compatible build tag syntax
    • e798dc2 Add docs on 1.17 build tags
    • 83198c2 assert: guard CanConvert call in backward compatible wrapper
    • 087b655 assert: allow comparing time.Time
    • 7bcf74e fix msgAndArgs forwarding
    • c29de71 add tests for correct msgAndArgs forwarding
    • f87e2b2 Update builds
    • ab6dc32 fix linting errors in /assert package
    • edff5a0 fix funtion name
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.5

    chore(deps): bump github.com/stretchr/testify from 1.7.1 to 1.7.5

    Bumps github.com/stretchr/testify from 1.7.1 to 1.7.5.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.1

    chore(deps): bump github.com/stretchr/testify from 1.7.5 to 1.8.1

    Bumps github.com/stretchr/testify from 1.7.5 to 1.8.1.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Add Parameters to Path

    Add Parameters to Path

    👋 Following Swagger Specification Parameters are part of the Path Parameter Object.

    This is a minor change to add Parameters to the Path Parameter Object.

  • Fails to parse path names starting with a question mark

    Fails to parse path names starting with a question mark

    I'm trying to parse an OpenAPI specification written in YAML that contains a path name that starts with a question mark, but the openapi.Parse function is returning the following error:

    2022/07/31 22:47:56 [7:5] unexpected key name
           4 |   version: 1.0.0
           5 | openapi: 3.0.1
           6 | paths:? /images/meta/{ImageID}.json
                   ^
           8 |   : description: Fetch a static image metadata
           9 |     get:
          10 |       description: Fetch static image metadata
          11 |       
    exit status 1
    

    Here is the OpenAPI specification that I'm using to produce the error:

    info:
      description: Example API
      title: Example API
      version: 1.0.0
    openapi: 3.0.1
    paths:
      ? /images/meta/{ImageID}.json
      : description: Fetch a static image metadata
        get:
          description: Fetch static image metadata
          operationId: FetchImageMetadata
          parameters:
          - description: ID of the image
            in: path
            name: ImageID
            required: true
            schema:
              maxLength: 36
              minLength: 36
              type: string
              pattern: ^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$
          responses:
            '200':
              description: OK
    
    

    The YAML seems to be valid syntax and is OpenAPI spec.

  • Fails to parse key names containing single quotes

    Fails to parse key names containing single quotes

    Hello! I'm trying to parse an OpenAPI specification written in YAML that contains a dictionary with key names that are enclosed in single quotes, but the openapi.Parse function is returning the following error:

    2022/07/31 22:24:21 [16:20] unexpected key name
          13 |         - args:
          14 |             field: registration
          15 |             mapping:
        > 16 |               '0': init
          17 |               '1': confirmation
                                  ^
          18 |               '2': active
    exit status 1
    

    Here is the OpenAPI specification that I'm using to produce the error:

    info:
      description: Example API
      title: Example API
      version: 1.0.0
    openapi: 3.0.1
    paths:
      /users:
        description: Users
        get:
          description: Retrieve all users
          operationId: ListUsers
          x-custom-properties:
            - args:
                field: registration
                mapping:
                  '0': init
                  '1': confirmation
                  '2': active
    

    As far as I know, the YAML is valid syntax and to OpenAPI spec.

Composable OpenAPI Specification (aka Swagger)
Composable OpenAPI Specification (aka Swagger)

compoas Library for building, composing and serving OpenAPI Specification (aka Swagger). Features This lib provides: golang structs which reflect Open

Jun 1, 2022
OpenAPI specification and related artifacts for HashiCorp Nomad

Overview This repository contains the HashiCorp Nomad OpenAPI specification and related artifacts. The OpenAPI specification defines a machine-readabl

Dec 14, 2022
Go types and validation for OpenAPI Specification 3.1

openapi Package openapi is a set of Go types for OpenAPI Specification 3.1. The primary purpose of the package is to assist in generation of OpenAPI d

Nov 10, 2022
CRUDist Model Driven Web Development. Automagically generate CRUD APIs from your model.

CRUDist - Model Driven API Development Automagicaly create CRUD APIs for your gorm models. Example Model definition type BaseModel struct { ID

Nov 15, 2021
Transmo - Transform Model into another model based on struct for Go (Golang).

Transmo Transmo is a Go library for transform model into another model base on struct. This library detect your field name to copy that into another m

Jan 7, 2022
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)
OpenAPI Terraform Provider that configures itself at runtime with the resources exposed by the service provider (defined in a swagger file)

Terraform Provider OpenAPI This terraform provider aims to minimise as much as possible the efforts needed from service providers to create and mainta

Dec 26, 2022
UPBit Auto Trading with OpenAPI Golang Module

Go-Bit! UPBit Auto Trading System with OpenAPI 이 레포지토리는 upbit를 위한 자동매매 프로그램을 개발하기 위해 제공하는 go module입니다. Features 구현 작업 진행상황 Sample Code Template shiel

Jun 27, 2022
Create a new OpenAPI based blink-plugin

OpenAPI plugin template Create a new OpenAPI based blink-plugin. READ FIRST Getting the Repo Option 1: From Github Press Use this template Naming conv

Oct 14, 2021
Build a retractable ECS load balance network through aliyun openapi.

ECSEquilizer 通过阿里云OpenAPI建立一个可伸缩的负载均衡网络调度器。 简介 为确保代理集群网络和计算能力可以通过ECS云服务动态伸缩,所以制定实现以下策略。 节点分为static和dynamic两种,static节点是通过配置文件(config.yaml)实现预设的,固定不变。 d

Jul 2, 2022
OpenAPI Client and Server Code Generator

This package contains a set of utilities for generating Go boilerplate code for services based on OpenAPI 3.0 API definitions

Dec 2, 2022
A fully-featured OpenAPI generated HubSpot client for Go
A fully-featured OpenAPI generated HubSpot client for Go

This is a HubSpot Go client generated using openapi-generator. It includes packages for every OpenAPI spec listed in HubSpot's API directory. Installi

Dec 31, 2022
Kusk makes your OpenAPI definition the source of truth for API resources in your cluster
Kusk makes your OpenAPI definition the source of truth for API resources in your cluster

Kusk - use OpenAPI to configure Kubernetes What is Kusk? Developers deploying their REST APIs in Kubernetes shouldn't have to worry about managing res

Dec 16, 2022
Entgo openapi example for go

entgo-openapi-example Example app created with ent entgen swagger-editor See https://entgo.io/blog/2021/09/10/openapi-generator/ License MIT Author Ya

Nov 27, 2021
OpenAPI specs for your Go server, generated at server runtime. No CLI, no code generation, and no HTTP

Overview "oas" is short for "OpenAPI Spec". Go package for generating OpenAPI docs at runtime. Non-features: No code generation. No CLI. No magic comm

Dec 3, 2021
This project extends the go-chi router to support OpenAPI 3, bringing to you a simple interface to build a router conforming your API contract.

Go OpenAPI This project extends the go-chi router to support OpenAPI 3, bringing to you a simple interface to build a router conforming your API contr

Mar 27, 2022
Go client + OpenAPI v3 spec for Oura-Ring

Oura Ring OpenAPIv3 Schema Definition + Go Client This repo contains an OpenAPIv3 schema definition for OuraRing OuraRing API documentation https://cl

Sep 20, 2022
OpenAPI for Todolist RESTful API

Go API client for swagger OpenAPI for Todolist RESTful API Overview This API cli

Dec 18, 2021
Laptop Booking Application in Golang and gRPC, load-balancing with NGINX, and fully compatible with HTTPS OpenAPI v3

Laptop Booking Application in Golang and gRPC Goals GitHub CI & Coverage Badge Serialize protobuf messages Create laptop unary gRPC Search laptop Serv

Jun 17, 2022
A Twirp RPC OpenAPI generator implemented as `protoc` plugin

twirp-openapi-gen A Twirp RPC OpenAPI generator implemented as protoc plugin Currently supports only OpenAPI 2.0 Usage Installing the generator for pr

May 26, 2022
Ali-DDNS - DDNS service by using Ali openapi

Ali-DDNS DDNS service by using Ali openapi Explore the docs » View Demo · Report

Jul 6, 2022