PW-7514: Fully Generated Management API client (#1064)

* PW-7514: Update models

* PW-7514: Switch to JAR based installation

* PW-7514: Default API template

* PW-7514: Customize API template

* PW-7514: Serialize request

* PW-7514: Query string

* PW-7514: Fix version patch

* PW-7514: Client generated

* PW-7514: Export class by default

* PW-7514: Make path and body params required

* PW-7514: Dynamic service name

* PW-7514: Link all classes into one parent

* PW-7514: Dynamic method names

* PW-7514: Fix merge issues

* PW-7514: Generate using latest specs

Co-authored-by: jillingk <93914435+jillingk@users.noreply.github.com>
This commit is contained in:
Michael Paul
2023-01-19 15:59:16 +01:00
committed by GitHub
parent 8c451502e3
commit 316542a166
58 changed files with 3444 additions and 30 deletions

View File

@@ -1,5 +1,8 @@
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
openapi-generator-version:=5.4.0
openapi-generator-url:=https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/$(openapi-generator-version)/openapi-generator-cli-$(openapi-generator-version).jar
openapi-generator-jar:=build/openapi-generator-cli.jar
openapi-generator-cli:=java -jar $(openapi-generator-jar)
services:=balancePlatform binlookup checkout dataProtection legalEntityManagement management payments payouts platformsAccount platformsFund platformsHostedOnboardingPage platformsNotificationConfiguration recurring storedValue terminalManagement transfer
# Generate models (for each service)
@@ -14,6 +17,8 @@ payments: spec=PaymentService-v68
recurring: spec=RecurringService-v68
payouts: spec=PayoutService-v68
management: spec=ManagementService-v1
managementapi: spec=ManagementService-v1
managementapi: service=management
legalEntityManagement: spec=LegalEntityService-v2
balancePlatform: spec=BalancePlatformService-v2
platformsAccount: spec=AccountService-v6
@@ -22,28 +27,48 @@ platformsNotificationConfiguration: spec=NotificationConfigurationService-v6
platformsHostedOnboardingPage: spec=HopService-v6
transfer: spec=TransferService-v3
$(services): build/spec
$(services): build/spec $(openapi-generator-jar)
rm -rf src/typings/$@ build/model
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-t templates/typescript \
-o build \
--global-property models,supportingFiles
--global-property models,supportingFiles \
--additional-properties=serviceName=$@
mv build/model src/typings/$@
# Service
managementapi: build/spec $(openapi-generator-jar)
$(openapi-generator-cli) generate \
-i build/spec/json/$(spec).json \
-g $(generator) \
-t templates/typescript \
-o build \
--api-package $(service) \
--model-package typings/$(service) \
--global-property apis \
--additional-properties=serviceName=$(service)
cp build/$(service)/* src/services/$(service)
sed -i.bak '/RestServiceError/d' src/services/$(service)/*
rm src/services/$(service)/*.bak
# 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
perl -i -pe's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' build/spec/json/*.json
# Extract templates (copy them for modifications)
templates:
templates: $(openapi-generator-jar)
$(openapi-generator-cli) author template -g $(generator) -o build/templates/typescript
# Download the generator
$(openapi-generator-jar):
wget --quiet -o /dev/null $(openapi-generator-url) -O $(openapi-generator-jar)
# Discard generated artifacts and changed models
clean:
git checkout src/typings
git clean -f -d src/typings
git checkout src/typings src/services/management
git clean -f -d src/typings src/services/management
.PHONY: templates models $(services)