generator
The generator
module contains the code generation logic.
The core of this work is around the Generator
class,
which divides up the processing of individual templates.
- class gapic.generator.generator.Generator(opts: gapic.utils.options.Options)[source]
A protoc code generator for client libraries.
This class provides an interface for getting a
CodeGeneratorResponse
for anAPI
schema object (which it does through rendering templates).- Parameters
opts (Options) – An options instance.
templates (str) – Optional. Path to the templates to be rendered. If this is not provided, the templates included with this application are used.
- get_response(api_schema: gapic.schema.api.API, opts: gapic.utils.options.Options) google.protobuf.compiler.plugin_pb2.CodeGeneratorResponse [source]
Return a
CodeGeneratorResponse
for this library.This is a complete response to be written to (usually) stdout, and thus read by
protoc
.- Parameters
api_schema (API) – An API schema object.
opts (Options) – An options instance.
- Returns
A response describing appropriate files and contents. See
plugin.proto
.- Return type
CodeGeneratorResponse