Categorygithub.com/vine-io/go-restful-openapi
modulepackage
0.4.5
Repository: https://github.com/vine-io/go-restful-openapi.git
Documentation: pkg.go.dev

# README

go-restful-openapi

Build Status GoDoc

openapi extension to the go-restful package, targeting version 3.0

The following Go field tags are translated to OpenAPI equivalents

  • description
  • minimum
  • maximum
  • optional ( if set to "true" then it is not listed in required)
  • unique
  • modelDescription
  • type (overrides the Go type String())
  • enum
  • readOnly

See TestThatExtraTagsAreReadIntoModel for examples.

dependencies

Go modules

import (
    restfulspec "github.com/vine-io/go-restful-openapi"
    restful "github.com/emicklei/go-restful/v3"
)

© 2024, MIT License. Contributions welcome.

# Packages

No description provided by the author

# Functions

BuildOpenAPIV3 returns a openapi object for all services' API endpoints.
DefaultNameHandler GoRestfulDefinition -> GoRestfulDefinition (not changed).
GoLowerCamelCasedNameHandler HTTPRestfulDefinition -> httpRestfulDefinition.
LowerCamelCasedNameHandler GoRestfulDefinition -> goRestfulDefinition.
LowerSnakeCasedNameHandler GoRestfulDefinition -> go_restful_definition.
NewOpenAPIService returns a new WebService that provides the API documentation of all services conform the OpenAPI documentation specifcation.
No description provided by the author

# Constants

Extension Parameters.
Extension Parameters.
ExtensionPrefix is the only prefix accepted for VendorExtensible extension keys.
KeyOpenAPITags is a Metadata key for a restful Route.
No description provided by the author
No description provided by the author

# Structs

Config holds service api metadata.
SchemaType is used to wrap any raw types For example, to return a "schema": "file" one can use Returns(http.StatusOK, http.StatusText(http.StatusOK), SchemaType{RawType: "file"}).

# Interfaces

Documented is.
No description provided by the author

# Type aliases

ComponentNameHandlerFunc generate name by this handler for definition without json tag.
No description provided by the author
MapModelTypeNameFunc can be used to return the desired typeName for a given type.
MapSchemaFormatFunc can be used to modify typeName at definition time.
No description provided by the author
PostBuildOpenAPIObjectFunc can be used to change the creates OpenAPI Object before serving it.