Documentation ¶
Index ¶
- Constants
- func ConstructType(aliasNameMap map[string]string, field *ast.Field) string
- func ConstructTypeParts(aliasNameMap map[string]string, parts []string) []string
- func CustomQueryToGraphqlSchema(query nexus.GraphQLQuery) string
- func GenerateImports(p *parser.Package, aliasNameMap map[string]string) []string
- func GetNexusSchemaFieldName(GraphQlSpec nexus.GraphQLSpec) string
- func GetNodeDetails(pkgName, typeString string, importMap map[string]string, pkgs parser.Packages, ...) string
- func GetPkg(pkgs parser.Packages, pkgPath string) parser.Package
- func RenderCRDTemplate(baseGroupName, crdModulePath string, pkgs parser.Packages, ...) error
- func RenderClient(baseGroupName, outputDir, crdModulePath string, pkgs parser.Packages, ...) error
- func RenderClientTemplate(baseGroupName, crdModulePath string, pkgs parser.Packages, ...) (*bytes.Buffer, error)
- func RenderDocTemplate(baseGroupName string, pkg parser.Package) (*bytes.Buffer, error)
- func RenderGQLGenTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
- func RenderGqlServerTemplate(vars ServerVars) (*bytes.Buffer, error)
- func RenderGqlserver(outputDir, crdModulePath string) error
- func RenderGraphQL(baseGroupName, outputDir, crdModulePath string, pkgs parser.Packages, ...) error
- func RenderGraphqlResolverTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
- func RenderGraphqlSchemaTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
- func RenderHelper(parentsMap map[string]parser.NodeHelper, outputDir string, ...) error
- func RenderHelperTemplate(parentsMap map[string]parser.NodeHelper, crdModulePath string) (*bytes.Buffer, error)
- func RenderNonNexusTypes(outputDir string, nonNexusTypes *parser.NonNexusTypes, fileset *token.FileSet) error
- func RenderRegisterCRDTemplate(crdModulePath, baseGroupName string, pkg parser.Package) (*bytes.Buffer, error)
- func RenderRegisterGroupTemplate(baseGroupName string, pkg parser.Package) (*bytes.Buffer, error)
- func RenderTypesTemplate(crdModulePath string, pkg parser.Package) (*bytes.Buffer, error)
- func SkipSecretSpecAnnotation(fieldName, nfType string, pkg parser.Package, importMap map[string]string, ...) bool
- func ValidateImportPkg(pkgName, typeString string, importMap map[string]string, pkgs parser.Packages) (string, string)
- type ApiGroupsVars
- type CommonVars
- type CrdBaseFile
- type FieldProperty
- type GraphDetails
- type GraphQLSchemaType
- type NexusAnnotation
- type NodeProperty
- type ReturnStatement
- type ServerVars
Constants ¶
View Source
const ( //GraphQL standard data types Int string = "Int" Float string = "Float" String string = "String" Boolean string = "Boolean" // Custom query CustomQuerySchema = `Id: ID ParentLabels: Map ` )
Variables ¶
This section is empty.
Functions ¶
func ConstructType ¶
TODO: https://jira.eng.vmware.com/browse/NPT-296 Support cross-package imports for the following additional types: 1. map[gns.MyStr][]gns.MyStr 2. map[string]map[string]gns.MyStr 3. []map[string]gns.MyStr 4. **gns.MyStr
func ConstructTypeParts ¶
func CustomQueryToGraphqlSchema ¶
func CustomQueryToGraphqlSchema(query nexus.GraphQLQuery) string
func GenerateImports ¶
func GetNexusSchemaFieldName ¶
func GetNexusSchemaFieldName(GraphQlSpec nexus.GraphQLSpec) string
func GetNodeDetails ¶
func RenderCRDTemplate ¶
func RenderCRDTemplate(baseGroupName, crdModulePath string, pkgs parser.Packages, graph map[string]parser.Node, outputDir string, httpMethods map[string]nexus.HTTPMethodsResponses, httpCodes map[string]nexus.HTTPCodesResponse, nonNexusTypes *parser.NonNexusTypes, fileset *token.FileSet, graphqlFiles map[string]string) error
func RenderClient ¶
func RenderClientTemplate ¶
func RenderDocTemplate ¶
func RenderGQLGenTemplate ¶
func RenderGQLGenTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
func RenderGqlServerTemplate ¶
func RenderGqlServerTemplate(vars ServerVars) (*bytes.Buffer, error)
func RenderGqlserver ¶
func RenderGraphQL ¶
func RenderGraphqlResolverTemplate ¶
func RenderGraphqlResolverTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
func RenderGraphqlSchemaTemplate ¶
func RenderGraphqlSchemaTemplate(vars GraphDetails, crdModulePath string) (*bytes.Buffer, error)
func RenderHelper ¶
func RenderHelperTemplate ¶
func RenderNonNexusTypes ¶
func RenderTypesTemplate ¶
func SkipSecretSpecAnnotation ¶
func SkipSecretSpecAnnotation(fieldName, nfType string, pkg parser.Package, importMap map[string]string, pkgs map[string]parser.Package) bool
SkipSecretSpecAnnotation checks if the field has nexus secrets annotated on them If yes, the field is skipped in the response.
Types ¶
type ApiGroupsVars ¶
type CommonVars ¶
type CommonVars struct {
Types string
}
type CrdBaseFile ¶
func RenderCRDBaseTemplate ¶
func RenderCRDBaseTemplate(baseGroupName string, pkg parser.Package, parentsMap map[string]parser.NodeHelper, httpMethods map[string]nexus.HTTPMethodsResponses, httpCodes map[string]nexus.HTTPCodesResponse) ([]CrdBaseFile, error)
type FieldProperty ¶
type FieldProperty struct { IsResolver bool IsNexusTypeField bool IsNexusOrSingletonField bool IsChildOrLink bool IsChildrenOrLinks bool IsMapTypeField bool IsArrayTypeField bool IsStdTypeField bool IsCustomTypeField bool IsPointerTypeField bool IsStringType bool IsArrayStdType bool IsSingleton bool PkgName string NodeName string FieldName string FieldType string FieldTypePkgPath string ModelType string SchemaFieldName string SchemaTypeName string BaseTypeName string Alias string ReturnType string FieldCount int CRDName string ChainAPI string LinkAPI string }
type GraphDetails ¶
type GraphDetails struct { BaseImportPath string Nodes []NodeProperty GraphQlFiles map[string]string }
type GraphQLSchemaType ¶
type GraphQLSchemaType int
const ( Standard GraphQLSchemaType = iota Array JsonMarshal Child Link NamedChild NamedLink AliasType )
type NexusAnnotation ¶
type NexusAnnotation struct { Name string `json:"name,omitempty"` Hierarchy []string `json:"hierarchy,omitempty"` Children map[string]parser.NodeHelperChild `json:"children,omitempty"` Links map[string]parser.NodeHelperChild `json:"links,omitempty"` IsSingleton bool `json:"is_singleton"` NexusRestAPIGen nexus.RestAPISpec `json:"nexus-rest-api-gen,omitempty"` Description string `json:"description,omitempty"` }
type NodeProperty ¶
type NodeProperty struct { IsParentNode bool HasParent bool IsSingletonNode bool IsNexusNode bool BaseImportPath string CrdName string ResolverCount int PkgName string NodeName string SchemaName string Alias string ReturnType string GroupResourceNameTitle string GroupName string Singular string Kind string ResourceName string ResourceVersion string Singleton string ChildFields []FieldProperty LinkFields []FieldProperty ChildrenFields []FieldProperty LinksFields []FieldProperty ArrayFields []FieldProperty CustomFields []FieldProperty NonStructFields []FieldProperty GraphqlSchemaFields []FieldProperty ResolverFields map[string][]FieldProperty CustomQueries []nexus.GraphQLQuery GraphQlSpec nexus.GraphQLSpec }
func GenerateGraphqlResolverVars ¶
func GenerateGraphqlResolverVars(baseGroupName, crdModulePath string, pkgs parser.Packages, parentsMap map[string]parser.NodeHelper) ([]NodeProperty, error)
GenerateGraphqlResolverVars populates the node and its field properties required to generate graphql resolver
func GenerateTsmGraphqlSchemaVars ¶
func GenerateTsmGraphqlSchemaVars(baseGroupName, crdModulePath string, pkgs parser.Packages, parentsMap map[string]parser.NodeHelper, nonNexusTypes *parser.NonNexusTypes) ([]NodeProperty, error)
GenerateTsmGraphqlSchemaVars populates the node and its field properties required to generate graphql resolver
type ReturnStatement ¶
type ServerVars ¶
type ServerVars struct {
BaseImportPath string
}
Click to show internal directories.
Click to hide internal directories.