mirror of
https://github.com/jlengrand/adyen-node-api-library.git
synced 2026-03-10 08:01:20 +00:00
PW-6881: Generate more models (#915)
* PW-6881: Base generation on checked out branch * Base the new PR on the current PR's branch * PW-6881: Set base on checkout * PW-6881: Generate Stored Value models * PW-6881: Permission issue * PW-6881: Run container without root * PW-6881: Supporting files are required * PW-6881: Remove debugging event * PW-6881: Add POS Terminal Management * PW-6881: Add Classic integration * PW-6881: Generate Recurring models * Update README.md Co-authored-by: Wouter Boereboom <62436079+wboereboom@users.noreply.github.com>
This commit is contained in:
52
Makefile
52
Makefile
@@ -1,26 +1,38 @@
|
||||
generator=typescript-node
|
||||
openapi-generator-cli=docker run --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
|
||||
generator:=typescript-node
|
||||
openapi-generator-cli:=docker run --user $(shell id -u):$(shell id -g) --rm -v ${PWD}:/local -w /local openapitools/openapi-generator-cli:v5.4.0
|
||||
services:=checkout storedValue terminalManagement payments recurring
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
# Generate models (for each service)
|
||||
models: $(services)
|
||||
|
||||
# Extract templates (copy them for modifications)
|
||||
.PHONY: templates
|
||||
templates:
|
||||
$(openapi-generator-cli) author template -g ${generator} -o build/templates/typescript
|
||||
checkout: spec=CheckoutService-v69
|
||||
storedValue: spec=StoredValueService-v46
|
||||
terminalManagement: spec=TfmAPIService-v1
|
||||
payments: spec=PaymentService-v68
|
||||
recurring: spec=RecurringService-v68
|
||||
|
||||
build/spec:
|
||||
mkdir -p build/spec
|
||||
|
||||
# Fetch spec files (git clone/submodule?)
|
||||
build/spec/CheckoutService-v69.json: build/spec
|
||||
wget https://raw.githubusercontent.com/Adyen/adyen-openapi/main/json/CheckoutService-v69.json -O build/spec/CheckoutService-v69.json
|
||||
sed -i 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/CheckoutService-v69.json
|
||||
|
||||
models: build/spec/CheckoutService-v69.json
|
||||
$(services): build/spec
|
||||
rm -rf src/typings/$@ build/model
|
||||
$(openapi-generator-cli) generate \
|
||||
-i build/spec/CheckoutService-v69.json \
|
||||
-g ${generator} \
|
||||
-i build/spec/json/$(spec).json \
|
||||
-g $(generator) \
|
||||
-t templates/typescript \
|
||||
-o build \
|
||||
--global-property models,supportingFiles
|
||||
--global-property models,supportingFiles
|
||||
mv build/model src/typings/$@
|
||||
|
||||
# Checkout spec (and patch version)
|
||||
build/spec:
|
||||
git clone https://github.com/Adyen/adyen-openapi.git build/spec
|
||||
sed -i 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
|
||||
|
||||
# Extract templates (copy them for modifications)
|
||||
templates:
|
||||
$(openapi-generator-cli) author template -g $(generator) -o build/templates/typescript
|
||||
|
||||
# Discard generated artifacts and changed models
|
||||
clean:
|
||||
git checkout src/typings
|
||||
git clean -f -d src/typings
|
||||
|
||||
.PHONY: templates models $(services)
|
||||
Reference in New Issue
Block a user