44# ###############################################################
55
66# The version of Swaggy C
7- SWAGGY_C_VERSION = 4.10 .0
7+ SWAGGY_C_VERSION = 5.1 .0
88
99# The version of OpenAPI Generator (https://openapi-generator.tech/) used for generating the API clients
10- OPENAPI_GENERATOR_VERSION = 7.12 .0
10+ OPENAPI_GENERATOR_VERSION = 7.18 .0
1111
12- # LANGS_ALL lists the languages supported by the given OPENAPI_GENERATOR_VERSION
13- LANGS_ALL = ada ada-server android apache2 apex asciidoc aspnetcore avro-schema bash crystal c clojure cwiki cpp-qt-client cpp-qt-qhttpengine-server cpp-pistache-server cpp-restbed-server cpp-restbed-server-deprecated cpp-restsdk cpp-tiny cpp-tizen cpp-ue4 csharp csharp-functions dart dart-dio eiffel elixir elm erlang-client erlang-proper erlang-server fsharp-functions fsharp-giraffe-server go go-echo-server go-server go-gin-server graphql-schema graphql-nodejs-express-server groovy kotlin kotlin-server kotlin-spring kotlin-vertx ktorm-schema haskell-http-client haskell haskell-yesod java jaxrs-cxf-client java-helidon-client java-helidon-server java-inflector java-micronaut-client java-micronaut-server java-msf4j java-pkmst java-play-framework java-undertow-server java-vertx java-vertx-web java-camel jaxrs-cxf jaxrs-cxf-extended jaxrs-cxf-cdi jaxrs-jersey jaxrs-resteasy jaxrs-resteasy-eap jaxrs-spec javascript javascript-apollo-deprecated javascript-flowtyped javascript-closure-angular java-wiremock jetbrains-http-client jmeter julia-client julia-server k6 lua markdown mysql-schema n4js nim nodejs-express-server objc ocaml openapi openapi-yaml plantuml perl php php-nextgen php-laravel php-lumen php-slim4 php-symfony php-mezzio-ph php-dt postman-collection powershell protobuf-schema python python-pydantic-v1 python-fastapi python-flask python-aiohttp python-blueplanet r ruby ruby-on-rails ruby-sinatra rust rust-server scalatra scala-akka scala-pekko scala-akka-http-server scala-finch scala-gatling scala-http4s-server scala-lagom-server scala-play-server scala-sttp scala-sttp4 scalaz spring dynamic-html html html2 swift5 swift-combine typescript typescript-angular typescript-aurelia typescript-axios typescript-fetch typescript-inversify typescript-jquery typescript-nestjs typescript-node typescript-redux-query typescript-rxjs wsdl-schema xojo-client zapier rust-axum
12+ # GENERATORS_ALL lists the generators supported by the given OPENAPI_GENERATOR_VERSION
13+ GENERATORS_ALL = ada ada-server android apache2 apex asciidoc aspnet-fastendpoints aspnetcore avro-schema bash crystal c clojure cwiki cpp-oatpp-client cpp-qt-client cpp-qt-qhttpengine-server cpp-oatpp-server cpp-pistache-server cpp-restbed-server cpp-restbed-server-deprecated cpp-restsdk cpp-tiny cpp-tizen cpp-ue4 csharp csharp-functions dart dart-dio eiffel elixir elm erlang-client erlang-proper erlang-server fsharp-functions fsharp-giraffe-server gdscript go go-echo-server go-server go-gin-server graphql-schema graphql-nodejs-express-server groovy haskell-http-client haskell haskell-yesod java java-dubbo jaxrs-cxf-client java-helidon-client java-helidon-server java-inflector java-micronaut-client java-micronaut-server java-msf4j java-pkmst java-play-framework java-undertow-server java-vertx-web java-camel jaxrs-cxf jaxrs-cxf-extended jaxrs-cxf-cdi jaxrs-jersey java-microprofile jaxrs-resteasy jaxrs-resteasy-eap jaxrs-spec javascript javascript-flowtyped javascript-closure-angular java-wiremock jetbrains-http-client jmeter julia-client julia-server k6 kotlin kotlin-misk kotlin-server kotlin-spring kotlin-vertx kotlin-wiremock ktorm-schema lua markdown mysql-schema n4js nim nodejs-express-server objc ocaml openapi openapi-yaml plantuml perl php php-flight php-nextgen php-lumen php-slim4 php-symfony php-mezzio-ph php-dt php-laravel postgresql-schema postman-collection powershell protobuf-schema python python-pydantic-v1 python-fastapi python-flask python-aiohttp python-blueplanet r ruby ruby-on-rails ruby-sinatra rust-axum rust rust-server rust-server-deprecated scalatra scala-akka scala-cask scala-pekko scala-akka-http-server scala-finch scala-gatling scala-http4s scala-http4s-server scala-play-server scala-sttp scala-sttp4 scala-sttp4-jsoniter scalaz spring dynamic-html html html2 swift5 swift6 swift-combine typescript typescript-angular typescript-aurelia typescript-axios typescript-fetch typescript-inversify typescript-jquery typescript-nestjs typescript-nestjs-server typescript-node typescript-redux-query typescript-rxjs wsdl-schema xojo-client zapier
1414
15- # LANGS_PRIMARY lists the languages which will be built and published to public package registries
16- LANGS_PRIMARY = javascript python ruby
15+ # GENERATORS_PRIMARY lists the generators which will be built and published to public package registries
16+ GENERATORS_PRIMARY = javascript python ruby
1717
1818# The location where OpenAPI specification file will be placed within the project
1919LOCAL_SPEC_PATH = stage/specification.yml
@@ -80,6 +80,9 @@ $(info - Application base directory: ${APP_BASE_DIR})
8080# CI target to be executed by CI/CD tool
8181ci : clean deps init-spec generate build-javascript build-python build-ruby test-javascript test-python test-ruby doc
8282
83+ # All target as an alias for CI target
84+ all : ci
85+
8386# Ensure stage directory exists
8487stage :
8588 mkdir -p stage
@@ -107,11 +110,22 @@ init-spec: stage
107110 fi
108111 yq -i ' .info.contact.name = "$(CONTACT_NAME)" | .info.contact.url = "$(CONTACT_URL)" | .info.contact.email = "$(CONTACT_EMAIL)"' " $( LOCAL_SPEC_PATH) "
109112
110- # Initialise basic configuration file for all languages
111- init-langs-config :
112- for lang in ${LANGS_ALL} ; do \
113- mkdir -p clients/$$ lang/; \
114- echo " {\n \" gitUserId\" : \" $( SCM_GIT_USER) \" ,\n \" gitRepoId\" : \" $( SCM_GIT_REPO) \" \n}" > clients/$$ lang/conf.json; \
113+ # Shows a list of available generators supported by the given OPENAPI_GENERATOR_VERSION
114+ # Output is a space-separated list of generator names to be used in GENERATORS_ALL variable
115+ list-generators :
116+ docker \
117+ run \
118+ --rm \
119+ -v $(APP_BASE_DIR ) :/local openapitools/openapi-generator-cli:v$(OPENAPI_GENERATOR_VERSION ) \
120+ list --short | tr ' ,' ' '
121+
122+ # Initialise basic configuration file for all generators
123+ init-generators-config :
124+ for generator in ${GENERATORS_ALL} ; do \
125+ if [ ! -d clients/$$ generator ]; then \
126+ mkdir -p clients/$$ generator/; \
127+ echo " {\n \" gitUserId\" : \" $( SCM_GIT_USER) \" ,\n \" gitRepoId\" : \" $( SCM_GIT_REPO) \" \n}" > clients/$$ generator/conf.json; \
128+ fi ; \
115129 done
116130
117131# Update Makefile to the latest version on origin's main branch
@@ -128,39 +142,39 @@ update-to-version:
128142# Alias for generate-all target
129143generate : generate-all
130144
131- # Generate API clients for all languages , this is separate from generate-primary target in order to
132- # reduce the build time when processing primary languages
145+ # Generate API clients for all generators , this is separate from generate-primary target in order to
146+ # reduce the build time when processing primary generators
133147# This target requires APP_BASE_DIR parameter to be supplied by user
134148generate-all :
135- for lang in ${LANGS_ALL } ; do \
149+ for generator in ${GENERATORS_ALL } ; do \
136150 docker \
137151 run \
138152 --rm \
139153 -v $(APP_BASE_DIR ) :/local openapitools/openapi-generator-cli:v$(OPENAPI_GENERATOR_VERSION ) \
140154 generate \
141155 --input-spec /local/$(LOCAL_SPEC_PATH ) \
142- --config /local/clients/$$ lang /conf.json \
143- --generator-name $$ lang \
144- --output /local/clients/$$ lang /generated; \
156+ --config /local/clients/$$ generator /conf.json \
157+ --generator-name $$ generator \
158+ --output /local/clients/$$ generator /generated; \
145159 done
146160
147- # Generate API clients for primary languages only
161+ # Generate API clients for primary generators only
148162# This target requires APP_BASE_DIR parameter to be supplied by user
149163generate-primary :
150- for lang in ${LANGS_PRIMARY } ; do \
164+ for generator in ${GENERATORS_PRIMARY } ; do \
151165 docker \
152166 run \
153167 --rm \
154168 -v $(APP_BASE_DIR ) :/local openapitools/openapi-generator-cli:v$(OPENAPI_GENERATOR_VERSION ) \
155169 generate \
156170 --input-spec /local/$(LOCAL_SPEC_PATH ) \
157- --config /local/clients/$$ lang /conf.json \
158- --generator-name $$ lang \
159- --output /local/clients/$$ lang /generated; \
171+ --config /local/clients/$$ generator /conf.json \
172+ --generator-name $$ generator \
173+ --output /local/clients/$$ generator /generated; \
160174 done
161175
162176# ###############################################################
163- # API clients building targets for primary languages
177+ # API clients building targets for primary generators
164178
165179build-javascript :
166180 npm install -g babel-cli
@@ -174,39 +188,51 @@ build-javascript:
174188build-python :
175189 cd clients/python/generated/ && \
176190 python3 -m venv .venv && \
177- $(call python_venv,pip install twine wheel pytest setuptools validators ) && \
191+ $(call python_venv,pip install twine wheel pytest setuptools) && \
178192 $(call python_venv,pip install -r requirements.txt) && \
179193 $(call python_venv,python3 setup.py sdist bdist_wheel) && \
180194 $(call python_venv,python3 setup.py install --single-version-externally-managed --record record.txt)
181195
182196build-ruby :
183197 apt-get install libyaml-dev
184198 cd clients/ruby/generated/ && \
185- find . -name ' *.gem' -delete && \
186- gem install bundler --version=1.17.3 && \
187- bundle install --binstubs && \
199+ rm -f * .gem && \
200+ gem install bundler && \
201+ bundle install && \
202+ bundle binstubs --all && \
188203 gem build * .gemspec && \
189204 gem install ./* .gem
190205
191206# ###############################################################
192- # API clients testing targets for primary languages
207+ # API clients testing targets for primary generators
208+
209+ # Test target is a convenience target to run tests for all primary generators
210+ test : test-javascript test-python test-ruby
193211
194212test-javascript : build-javascript
195213 npm install -g mocha
196214 npm install validator
197215 cd clients/javascript/generated/ && \
216+ npm install --dev && \
198217 npm run test
199- mocha --timeout 5000 test/javascript/
218+ cd test/javascript/ && \
219+ npm link ../../clients/javascript/generated/ && \
220+ mocha --timeout 5000 .
200221
201222test-python : build-python
202223 cd clients/python/generated/ && \
224+ $(call python_venv,pip install validators) && \
203225 $(call python_venv,twine check dist/* ) && \
204226 $(call python_venv,pytest -v ../../../test/python/* .py --capture=no)
205227
206228test-ruby : build-ruby
229+ cd clients/ruby/generated/ && \
230+ rm -f * .gem && \
231+ bundle exec rspec --format documentation && \
232+ bundle exec rspec ../../../test/ruby/ --format documentation
207233
208234# ###############################################################
209- # API clients package publishing targets for primary languages
235+ # API clients package publishing targets for primary generators
210236
211237publish-javascript : build-javascript
212238 cd clients/javascript/generated/ && \
@@ -241,4 +267,4 @@ doc-publish:
241267
242268# ###############################################################
243269
244- .PHONY : all test ci stage clean deps init-spec init-langs -config generate generate-all generate-primary build-javascript build-python build-ruby test-javascript test-python test-ruby publish-javascript publish-python publish-ruby doc doc-latest doc-version doc-publish
270+ .PHONY : all test ci stage clean deps init-spec init-generators -config generate generate-all generate-primary build-javascript build-python build-ruby test-javascript test-python test-ruby publish-javascript publish-python publish-ruby doc doc-latest doc-version doc-publish
0 commit comments