codegen

command module
v0.0.0-...-23b709f Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

README

Code Generation

About

This is a rewrite of Riven's code generation, the "dot-gen" project is licensed under the GPLv2 license and so is this rewrite.

You can find the source code for Riven here and the code for the "dot-gen" project here.

In addition, the specs that are downloaded and used are from riotapi-schema project.

Changes

Changes had to be made to translate the Rust output to Golang (I miss Option<>), mainly with how the clients are organized (I miss impl).

Changes includes all libraries used, such as pongo2 for templating, strcase for case conversion and gjson for navigating through the JSON files.

Usage

First, install betteralign and goimports:

go install github.com/dkorunic/betteralign/cmd/betteralign@latest && go install golang.org/x/tools/cmd/goimports@latest`

To generate code, run from the root of the equinox project:

go generate ./...

To update the specs, you can do either:

# from the root of equinox
UPDATE_SPECS=1 go generate ./...
# or from inside the codegen folder
go run . -update

Todo

  • Improve flow, currently a lot of functions are being reused and edge cases that might pop up can be really annoying to fix.
  • Add checks for required fields (queries and headers), returning errors if they are missing, for now only Authorization headers are required so it's not a big deal.
  • Generating code may allow for some performance improvements.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL