OpenAPITools / OpenAPITools/openapi-generator

[REQ] gRPC client/server libs snippet engine templating plugin

Open
#5,096 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

googleapis use a specific templating engine for their client-side SDK.

the template engine uses .snip files present in https://github.com/googleapis/gapic-generator/tree/master/src/main/resources/com/google/api/codegen

.snip snippet file example:

# Provides common utility functions.

#
# A logical and.
#
@snippet and(a, b) horizontal
  @if a
    @if b
      and: true
    @end
  @end
@end

the template engine implementation is made using Java and the code seems to include linting functions for validation and also some "common practices" and certification-included checks. Code is present here:
https://github.com/googleapis/api-compiler/tree/master/src/main/java/com/google/api/tools/framework/snippet

and then there's yet an additional tool called gapic-generator. This tool grabs some features from the api-compiler (like the mentioned .snip templating engine, a yaml-based engine for default settings definition, and more) and serves as an executable CLI tool to generate the client libs, which can also be fed with Artman (yet another tool) ready pipelines for the client lib generation.
https://github.com/googleapis/gapic-generator

Artman is the final wrapper around the tools, according to the artman readme:

The artman tool is a wrapper around toolkit; it takes the configuration enumerated above, normalizes it, and sends it to *toolkit, which generates a client library on disk, and then artman performs some concluding cleanup.

Client libraries produced in this way are executable "out of the box", and include basic reference documentation, and appropriate packaging and metadata files.

*toolkit= the previous codename of gapic-generator
it would be very useful to have a plugin in the openapi-generator that can consume the grpc schemas generated by: https://github.com/OpenAPITools/openapi-generator/pull/3818 and user created .snip files to make gRPC client/server libs

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing OpenAPI Generator PR 3818 and the api-compiler snippet implementation under src/main/java/com/google/api/tools/framework/snippet. Compare the .snip and YAML capabilities described in gapic-generator and Artman. Done would mean a defined plugin that consumes the generated gRPC schemas and user-created .snip files to generate client and server libraries.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, java
Domain
api, backend-api-design, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.