config.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package swagger
  2. import (
  3. "net/http"
  4. "github.com/emicklei/go-restful"
  5. )
  6. // PostBuildDeclarationMapFunc can be used to modify the api declaration map.
  7. type PostBuildDeclarationMapFunc func(apiDeclarationMap *ApiDeclarationList)
  8. type MapSchemaFormatFunc func(typeName string) string
  9. type Config struct {
  10. // url where the services are available, e.g. http://localhost:8080
  11. // if left empty then the basePath of Swagger is taken from the actual request
  12. WebServicesUrl string
  13. // path where the JSON api is avaiable , e.g. /apidocs
  14. ApiPath string
  15. // [optional] path where the swagger UI will be served, e.g. /swagger
  16. SwaggerPath string
  17. // [optional] location of folder containing Swagger HTML5 application index.html
  18. SwaggerFilePath string
  19. // api listing is constructed from this list of restful WebServices.
  20. WebServices []*restful.WebService
  21. // will serve all static content (scripts,pages,images)
  22. StaticHandler http.Handler
  23. // [optional] on default CORS (Cross-Origin-Resource-Sharing) is enabled.
  24. DisableCORS bool
  25. // Top-level API version. Is reflected in the resource listing.
  26. ApiVersion string
  27. // If set then call this handler after building the complete ApiDeclaration Map
  28. PostBuildHandler PostBuildDeclarationMapFunc
  29. // Swagger global info struct
  30. Info Info
  31. // [optional] If set, model builder should call this handler to get addition typename-to-swagger-format-field convertion.
  32. SchemaFormatHandler MapSchemaFormatFunc
  33. }