Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // TSImportRootParamsKey contains the key for common_import_root in parameters TSImportRoots string // TSImportRootAliasParamsKey contains the key for common_import_root_alias in parameters TSImportRootAliases string // FetchModuleDirectory is the parameter for directory where fetch module will live FetchModuleDirectory string // FetchModuleFilename is the file name for the individual fetch module FetchModuleFilename string // UseProtoNames will generate field names the same as defined in the proto UseProtoNames bool // UseStaticClasses will cause the generator to generate a static class in the form ServiceName.MethodName, which is // the legacy behavior for this generator. If set to false, the generator will generate a client class with methods // as well as static methods exported for each service method. UseStaticClasses bool // EmitUnpopulated mirrors the grpc gateway protojson configuration of the same name and allows // clients to differentiate between zero values and optional values that aren't set. EmitUnpopulated bool // EnableStylingCheck enables both eslint and tsc check for the generated code EnableStylingCheck bool }
type Registry ¶
type Registry struct { Options // Types stores the type information keyed by the fully qualified name of a type Types map[string]*TypeInformation // FilesToGenerate contains a list of actual file to generate, different from all the files from // the request, some of which are import files FilesToGenerate map[string]bool // TSImportRoots represents the ts import root for the generator to figure out required import // path, will default to cwd TSImportRoots []string // TSImportRootAliases if not empty will substitutes the common import root when writing the // import into the js file TSImportRootAliases []string // TSPackages stores the package name keyed by the TS file name TSPackages map[string]string }
Registry analyze generation request, spits out the data the the rendering process it also holds the information about all the types.
func NewRegistry ¶
NewRegistry initialise the registry and return the instance.
func (*Registry) Analyse ¶
Analyse analyses the the file inputs, stores types information and spits out the rendering data.
func (*Registry) IsFileToGenerate ¶
IsFileToGenerate contains the file to be generated in the request.
type TypeInformation ¶
type TypeInformation struct { // Fully qualified name of the type, it starts with `.` and followed by packages and the nested // structure path. FullyQualifiedName string // Package is the package of the type it belongs to Package string // Files is the file of the type belongs to, this is important in Typescript as modules is the // namespace for types defined inside File string // ModuleIdentifier is the identifier of the type inside the package, this will be useful for enum // and nested enum. PackageIdentifier string // LocalIdentifier is the identifier inside the types local scope LocalIdentifier string // ProtoType is the type inside the proto. This is used to tell whether it's an enum or a message ProtoType descriptorpb.FieldDescriptorProto_Type // IsMapEntry indicates whether this type is a Map Entry IsMapEntry bool // KeyType is the type information for the map key KeyType *data.MapEntryType // Value type is the type information for the map value ValueType *data.MapEntryType }
TypeInformation store the information about a given type.
Click to show internal directories.
Click to hide internal directories.