File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change @@ -42,3 +42,6 @@ target/
4242demo /jars /*
4343demo /notebook /.ipynb_checkpoints /*
4444my_config.yaml
45+
46+ # REST generated models
47+ spec /generated
Original file line number Diff line number Diff line change @@ -25,7 +25,11 @@ PIP := $(VENV_DIR)/bin/pip
2525VALIDATOR := $(VENV_DIR ) /bin/openapi-spec-validator
2626SPEC := rest-service-open-api.yaml
2727
28- .PHONY : all venv install lint clean
28+ # Configuration for model generation
29+ GEN_DIR := generated
30+ MODEL_PKG := org.apache.xtable.service.models
31+
32+ .PHONY : all venv install lint clean clean-models
2933
3034all : lint
3135
@@ -49,4 +53,20 @@ lint: install
4953# Remove the virtualenv
5054clean :
5155 @echo " → removing $( VENV_DIR) …"
52- rm -rf $(VENV_DIR )
56+ rm -rf $(VENV_DIR )
57+
58+ # Generate Java model classes from OpenAPI spec
59+ generate-models :
60+ @echo " → generating Java model classes from $( SPEC) …"
61+ openapi-generator generate \
62+ -i $(SPEC ) \
63+ -g java \
64+ -o $(GEN_DIR ) \
65+ --model-package $(MODEL_PKG ) \
66+ --global-property models,modelTests=false,modelDocs=false
67+ @echo " → models generated in $( GEN_DIR) /src/main/java/$( subst .,/,$( MODEL_PKG) ) "
68+
69+ # Remove all generated model classes
70+ clean-models :
71+ @echo " → removing generated models in $( GEN_DIR) …"
72+ rm -rf $(GEN_DIR )
Original file line number Diff line number Diff line change @@ -33,4 +33,20 @@ make lint
3333if you want to wipe out the venv and start fresh run make clean
3434``` sh
3535make clean
36+ ```
37+
38+ ## Generate
39+
40+ Note: You’ll need the OpenAPI Generator CLI installed and on your ` PATH ` . You can install it using Homebrew:
41+ ``` sh
42+ brew install openapi-generator
43+ ```
44+ Then to generate the java models from the open-api spec, you can run the ` generate-models ` command.
45+
46+ ``` sh
47+ make generate-models
48+ ```
49+ If you would to remove the generated models, you can run the ` clean-models ` command:
50+ ``` sh
51+ make clean-models
3652```
You can’t perform that action at this time.
0 commit comments