Reviews appreciated! Just create an issue with your review/question/request.
Tool to generate Golang (Go) SDK code for VK API implementation based on public JSON schema.
This tool uses official VK API JSON schema as input to generate VK API SDK code for Golang.
The result code is located here: https://github.com/Burmuley/go-vkapi. See README.md in the target repository for details about SDK.
What works:
- Golang types generation for all VK API data structures enlisted in
objects.json
schema; result code is located atobjects
subdirectory - Golang types generation for all VK API responses enlisted in
responses.json
schema; result code is located atresponses
subdirectory - Golang types generation for all VK API methods enlisted in
metods.json
schema; result code is located atrepo root
- Include of static code (common interfaces and VK API interaction utils)
- Golang code formatting for generated code
- Documentation (i.e. description) is taken from JSON schema files, i.e. no documentation in JSON schema - no documentation in produced code
What TODO:
- Create output directory structure on the fly
- Add tests for the generator code
- Add code to generate tests for resulting SDK code
The tool by default use these inputs:
objects
- https://raw.githubusercontent.com/VKCOM/vk-api-schema/master/objects.jsonresponses
- https://raw.githubusercontent.com/VKCOM/vk-api-schema/master/responses.jsonmethods
- https://raw.githubusercontent.com/VKCOM/vk-api-schema/master/methods.json
Default output directory is output
located in the repository root.
These settings can be overridden by setting corresponding environment variables:
- to override
objects
- setVK_API_SCHEMA_OBJECTS
environment variable - to override
responses
- setVK_API_SCHEMA_RESPONSES
environment variable - to override
methods
- setVK_API_SCHEMA_METHODS
environment variable - to override
output
directory location - setVK_API_SCHEMA_OUTPUT
environment variable
Variables values can be of two types:
- HTTP URL to the target file (doesn't support any kind of authentication)
- Local file path (format depends on OS, tested with unix-like ones)
There is a CI/CD job triggered on each commit to master
branch, which builds the tool and then commits to a remote repository, creating a merge request.
Tool does not require any command line parameters.
$ go build -o go-vkapi-gen
$ ./go-vkapi-gen
All the code (in this repository and produced by the tool) is licensed under Apache 2.0 license.