Giter Club home page Giter Club logo

yacg's Introduction

yacg - yet another code generation

The purpose of this project is to handle JSON schema models and generate stuff based on them.

Possible use-case are for instance to create PlanUML class diagrams based on the models, create bean classes based on model or more sophisticated create fully dao code with included tests.

Basically it's a tool to play with model driven development ...

The general workflow is:

  1. Take a bunch of models - for this tool JSON schemas
  2. Use some suitable templates
  3. Feed all of them into the tool
  4. yacg - processes templates and models
  5. ... and produces different text outputs

Even if this tool written in Python it can be used to create text output in every format - all depends from choosen templates.

To free the usage of yacg from too much care about dependencies, is on Docker Hub https://hub.docker.com/repository/docker/okieoth/yacg/general also a docker image, from the latest master brunch push, available.

# pull the image
docker pull okieoth/yacg

Usage

Basic Usage

# basic preparation
pip install --user pipenv

pipenv --python 3.8
pipenv --three install
pipenv shell

# do a demo run ... and create plantuml
pipenv run python3 yacg.py \
    --models resources/models/json/yacg_config_schema.json \
             resources/models/json/yacg_model_schema.json \
    --singleFileTemplates plantUml=stdout

# demo run with protobuf example output
pipenv run python3 yacg.py \
    --models resources/models/json/yacg_config_schema.json \
             resources/models/json/yacg_model_schema.json \
    --singleFileTemplates protobuf=stdout


# run a test
pipenv run python3 -m unittest -v tests/model/test_model.py

# run all tests
pipenv run python3 -m unittest discover tests "test_*.py"

Docker

# build a docker images
./bin/buildDockerImage.sh

# run the docker image
cd REPO_PATH
docker run -u $(id -u ${USER}):$(id -g ${USER}) -v `pwd`/resources:/resources --rm -t okieoth/yacg:0.13.0 \
    --models /resources/models/json/yacg_config_schema.json \
             /resources/models/json/yacg_model_schema.json \
    --singleFileTemplates plantUml=stdout

docker run -u $(id -u ${USER}):$(id -g ${USER}) -v `pwd`/resources:/resources --rm -t okieoth/yacg:0.13.0 \
    --models /resources/models/json/yacg_config_schema.json \
             /resources/models/json/yacg_model_schema.json \
    --singleFileTemplates xsd=stdout

Documentation

Mako templates

Visual Studio Code

This project is written with vscode as editor. It contains also the .vscode configuration for the development.

Most interesting are in the debug section to pre-configured debugging tasks for the included tests.

  • 'current tests' expects a open test file in the editor, and if this configuration is started, all test from this file are executed.
  • 'all tests' let run all tests in the 'tests' folder of the repository

Some Last Words

This project is a spare time project - with all its pros and cons. The development of project this project is done under a Linux OS, so I have no clue how it is working on Windows machines.

yacg's People

Contributors

okieoth avatar kylape avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.