Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample config, API backend generation
!import "common.groovy"
!import "springboot.groovy"
!import "postgres.groovy"
!merge "moreConfig.yaml" #!dominant
!merge "otherConfig.yaml" #!submissive
- db: "postgres"
- production:
- host: ""
- username: "username"
- password: "password"
- staging:
- host: ""
- username: "staging"
- password: "changeme"
- development:
- default: true
- host: "localhost"
- username: "clientdatabase"
- password: "test"
- 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´
Copy link

artheus commented Sep 25, 2016

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.

Copy link

artheus commented Sep 25, 2016

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