generator

package
v1.3.1059 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2019 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpenApiDir              = "openapi"
	SchemaWriterSrcFileName = "schema_writer_generated.go"
	OpenApiV2JSON           = "openapiv2.json"
	OpenApiV2YAML           = "openapiv2.yaml"
)

Variables

This section is empty.

Functions

func AssembleAPIDocs

func AssembleAPIDocs(srcDir string, outputDir string) error

AssembleAPIDocs copies the generated html files and the static files from srcDir into outputDir

func AssembleAPIDocsStatic

func AssembleAPIDocsStatic(referenceDocsRepo string, outputDir string) error

AssembleAPIDocsStatic copies the static files from the referenceDocsRepo to the outputDir. It also downloads from CDN jquery and bootstrap js

func GenerateAPIDocs

func GenerateAPIDocs(configDir string) error

GenerateAPIDocs runs the apidocs-gen tool against configDirectory which includes the openapi-spec dir, the config.yaml file, static content and the static_includes

func GenerateClient

func GenerateClient(generators []string, groupsWithVersions []string, inputPackage string, outputPackage string,
	outputBase string, boilerplateFile string) error

GenerateClient runs the generators specified. It looks at the specified groupsWithVersions in inputPackage and generates to outputPackage ( // relative to the module outputBase). A boilerplateFile is written to the top of any generated files.

func GenerateOpenApi

func GenerateOpenApi(groupsWithVersions []string, inputPackage string, outputPackage string, relativePackage string,
	outputBase string, openApiDependencies []string, moduleDir string, moduleName string, gitter gits.Gitter,
	boilerplateFile string) error

GenerateOpenApi generates the OpenAPI structs and schema files. It looks at the specified groupsWithVersions in inputPackage and generates to outputPackage ( relative to the module outputBase). Any openApiDependencies also have OpenAPI structs generated. A boilerplateFile is written to the top of any generated files. The gitter client is used to ensure the correct versions of dependencies are loaded.

func GenerateSchema

func GenerateSchema(outputDir string, inputPackage string, inputBase string, title string, version string) error

GenerateSchema calls the generated schema writer and then loads the output and also writes out a yaml version. The outputDir is the base directory for writing the schemas to (they get put in the openapi-spec subdir), inputPackage is the packge in which generated code lives, inputBase is the path to the module, title and version are used in the OpenAPI spec files.

func GetBoilerplateFile

func GetBoilerplateFile(fileName string) (string, error)

GetBoilerplateFile is responsible for canonicalizing the name of the boilerplate file

func InstallCodeGenerators

func InstallCodeGenerators(version string) error

InstallCodeGenerators installs client-gen from the kubernetes-incubator/reference-docs repository.

func InstallGenAPIDocs

func InstallGenAPIDocs() (string, error)

InstallGenAPIDocs installs the gen-apidocs tool from the kubernetes-incubator/reference-docs repository. Returns the base directory of reference-docs within the GOPATH.

func InstallOpenApiGen

func InstallOpenApiGen() error

InstallOpenApiGen installs the openapi-gen tool from the github.com/kubernetes/kube-openapi repository.

func WriteSchemaToDisk

func WriteSchemaToDisk(outputDir string, title string, version string, definitions common.GetOpenAPIDefinitions,
	names []string) error

WriteSchemaToDisk is called by the code generated main function to marshal the contents of the OpenAPI structs and write them to disk. outputDir is the dir to write the json and yaml files to, you can also provide the title and version for the OpenAPI spec. definitions is the function that returns all the openapi definitions. WriteSchemaToDisk will rewrite the definitions to a dot-separated notation, reversing the initial domain name

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL