generator

package
v2.1.93 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 20 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 DetermineSourceLocation

func DetermineSourceLocation(moduleDir string, gopath string) (string, error)

DetermineSourceLocation determines the source location for the installed kubernetes-incubator/reference-docs/ The location is based on GOPATH/pkd/mod and the current version.

func GenerateAPIDocs

func GenerateAPIDocs(configDir string, gopath 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,
	relativePackage string, outputBase string, boilerplateFile string, gopath string, semVer 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, boilerplateFile string, gopath string, semVer 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, gopath 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 package 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, gopath string) error

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

func InstallGenAPIDocs

func InstallGenAPIDocs(version string, gopath string) error

InstallGenAPIDocs installs the gen-apidocs tool from the kubernetes-incubator/reference-docs repository.

func InstallOpenApiGen

func InstallOpenApiGen(version string, gopath string) 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