Last active
September 25, 2016 10:18
-
-
Save artheus/71974e07e33f08edb507fb5d1b812aaa to your computer and use it in GitHub Desktop.
Sample config, API backend generation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!import "common.groovy" | |
!import "springboot.groovy" | |
!import "postgres.groovy" | |
!merge "moreConfig.yaml" #!dominant | |
!merge "otherConfig.yaml" #!submissive | |
springboot: | |
- db: "postgres" | |
postgres: | |
- production: | |
- host: "database.example.com" | |
- username: "username" | |
- password: "password" | |
- staging: | |
- host: "stagingdb.example.org" | |
- username: "staging" | |
- password: "changeme" | |
- development: | |
- default: true | |
- host: "localhost" | |
- username: "clientdatabase" | |
- password: "test" | |
api: | |
- name: "ClientDatabase" | |
- type: "springboot" | |
- entities: | |
- client: | |
- id: "PK,AI" | |
- name: | |
- type: "string" | |
- length: 128 | |
- wealth: | |
- type: "long" | |
- households: | |
- relation: "multi household" | |
- related: | |
- relation: "multi client" | |
- household: | |
- id: "PK,AI" | |
- address: | |
- type: "string" | |
- length: 256 | |
- endpoints: | |
- "household/calculate_price": ´sum(household.getClients()*.getWealth()) * 0.15´ |
I think it might also be a cool idea to use Java 8 Streams for adding functionality to the generated api. Maybe even using streams to override etc.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The idea is that the entities will be generated as Java Spring beans the database and everything will be set up automagically.
The generates source from this should be accessable in class_path and overrides,additions,etc to the api can be made with regular java code.
Could be a good idea to have a cli tool for this to, so that you can with that generate single or complete sets of overriding classes generated from this configuration.