https://github.com/apioo/typeschema-generator
TypeSchema code generator
https://github.com/apioo/typeschema-generator
code-generation code-generator generator model typeschema
Last synced: 10 months ago
JSON representation
TypeSchema code generator
- Host: GitHub
- URL: https://github.com/apioo/typeschema-generator
- Owner: apioo
- License: mit
- Created: 2023-05-25T19:07:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-30T10:20:26.000Z (over 1 year ago)
- Last Synced: 2025-04-12T05:37:18.711Z (about 1 year ago)
- Topics: code-generation, code-generator, generator, model, typeschema
- Language: Dockerfile
- Homepage: https://typeschema.org/
- Size: 91.8 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# TypeSchema Generator
## About
This repository contains the [TypeSchema](https://typeschema.org/) code generator provided as [docker image](https://hub.docker.com/repository/docker/apiootech/typeschema-generator).
## Usage
To get started you can simply use the `docker-compose up` command to start the generator. The generator reads the
`typeschema.json` file from the `output/` folder and writes the generated code into the output folder. Which language
is used depends on the `FORMAT` environment variable.
```
docker-compose up
```
By default the generator uses the local schema file specified at the `SOURCE` env variable but it is also possible
to use a different source i.e. you can use an `https://` url which points to a remote schema or you can also directly
reference a schema at [TypeHub](https://typehub.cloud/) with i.e. `typehub://apioo:developer@1.0.1`
## Integration
This repository contains also integration tests for every supported language. Please take a look at the `integration/`
folder to see examples how you can use the generated code. Our GitHub [workflow action](.github/workflows/integration.yml)
uses the Docker-Image to generate the code in the target language and then builds a release in combination with a small
wrapper code which reads the [input.json](integration/input.json) transforms this JSON into an internal representation,
using the generated models and writes the result back to `integration/output.json`. Through this we test the complete
serialize/deserialize flow with the generated models.
## Configuration
The following shows some example environment variables for different programming languages, you can paste those settings
directly into the `.env` file.
#### CSharp
```
FORMAT="csharp"
NAMESPACE="Generator"
```
#### Go
```
FORMAT="go"
NAMESPACE="generator"
```
#### Java
```
FORMAT="java"
NAMESPACE="org.typeschema.generator"
```
#### PHP
```
FORMAT="php"
NAMESPACE="Generator"
```
#### Python
```
FORMAT="python"
NAMESPACE=""
```
#### Ruby
```
FORMAT="ruby"
NAMESPACE=""
```
#### Rust
```
FORMAT="rust"
NAMESPACE=""
```
#### TypeScript
```
FORMAT="typescript"
NAMESPACE=""
```
#### VisualBasic
```
FORMAT="visualbasic"
NAMESPACE=""
```