package restfulspec
import "github.com/emicklei/go-restful-openapi"
Index ¶
- Constants
- func BuildSwagger(config Config) *spec.Swagger
- func NewOpenAPIService(config Config) *restful.WebService
- type Config
- type Documented
- type MapModelTypeNameFunc
- type MapSchemaFormatFunc
- type PostBuildSwaggerObjectFunc
Constants ¶
const KeyOpenAPITags = "openapi.tags"
KeyOpenAPITags is a Metadata key for a restful Route
Functions ¶
func BuildSwagger ¶
BuildSwagger returns a Swagger object for all services' API endpoints.
func NewOpenAPIService ¶
func NewOpenAPIService(config Config) *restful.WebService
NewOpenAPIService returns a new WebService that provides the API documentation of all services conform the OpenAPI documentation specifcation.
Types ¶
type Config ¶
type Config struct { // [optional] If set then set this field with the generated Swagger Object Host string // WebServicesURL is a DEPRECATED field; it never had any effect in this package. WebServicesURL string // APIPath is the path where the JSON api is avaiable , e.g. /apidocs.json APIPath string // api listing is constructed from this list of restful WebServices. WebServices []*restful.WebService // [optional] on default CORS (Cross-Origin-Resource-Sharing) is enabled. DisableCORS bool // Top-level API version. Is reflected in the resource listing. APIVersion string // [optional] If set, model builder should call this handler to get addition typename-to-swagger-format-field conversion. SchemaFormatHandler MapSchemaFormatFunc // [optional] If set, model builder should call this handler to retrieve the name for a given type. ModelTypeNameHandler MapModelTypeNameFunc // [optional] If set then call this function with the generated Swagger Object PostBuildSwaggerObjectHandler PostBuildSwaggerObjectFunc }
Config holds service api metadata.
type Documented ¶
Documented is
type MapModelTypeNameFunc ¶
MapModelTypeNameFunc can be used to return the desired typeName for a given type. It will return false if the default name should be used. To use it set the ModelTypeNameHandler in the config.
type MapSchemaFormatFunc ¶
MapSchemaFormatFunc can be used to modify typeName at definition time. To use it set the SchemaFormatHandler in the config.
type PostBuildSwaggerObjectFunc ¶
PostBuildSwaggerObjectFunc can be used to change the creates Swagger Object before serving it. To use it set the PostBuildSwaggerObjectHandler in the config.
Source Files ¶
build_definitions.go build_path.go config.go definition_builder.go lookup.go property_ext.go spec_resource.go
Directories ¶
Path | Synopsis |
---|---|
examples | |
examples/security |
- Version
- v1.1.0
- Published
- Jun 17, 2019
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- now –
Tools for package owners.