-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PW-7307] Gh pipeline and Makefile to generate Models (#668)
* Added async support for local terminal API * removed th tls1.2 configuration * Added retrieve3ds2result endpoints + UT * Added cardDetails Endpoint in checkout * UT for carddetails endpoint * fix integration test * FiXIntEgrAtiOntEsT * Revert "Added async support for local terminal API" This reverts commit 21bd6d0. * Revert "removed th tls1.2 configuration" This reverts commit c45131f. * create openapi templates for dotnet * added Makefile * trying out git makemodels * add workflow * add push * 123456432 * merged templates in this branch && changed template to include DateConverter * small change * revert Checkout models * Revert "FiXIntEgrAtiOntEsT" This reverts commit dc5ad0a. * Revert "fix integration test" This reverts commit 72f7710. * Revert "UT for carddetails endpoint" This reverts commit abf0856. * Revert "Added cardDetails Endpoint in checkout" This reverts commit 0ac0211. * Revert "Added retrieve3ds2result endpoints + UT" This reverts commit 9c0156a. * changed makefile * small fix * final commit * remove last constructer param validation and headers fix * cleanup * change templates back to original * changed Makefile to use jar instead of docker * Update Makefile Co-authored-by: Michael Paul <michael@michaelpaul.com.br> * small fix Co-authored-by: wouterboe <wouter.boereboom@adyen.com> Co-authored-by: Michael Paul <michael@michaelpaul.com.br>
- Loading branch information
1 parent
efb3e34
commit b0b432a
Showing
26 changed files
with
158 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: .NET Library Models | ||
|
||
on: [ workflow_dispatch ] | ||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
name: Generate Models | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: make models | ||
- name: Set PR variables | ||
id: vars | ||
run: | | ||
cd build/spec | ||
echo ::set-output name=pr_title::"Update models" | ||
echo ::set-output name=pr_body::"OpenAPI spec or templates produced new models on $(date +%d-%m-%Y) \ | ||
by [commit](https://github.com/Adyen/adyen-openapi/commit/$(git rev-parse HEAD))." | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.ADYEN_AUTOMATION_BOT_ACCESS_TOKEN }} | ||
committer: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }} | ||
author: ${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }} | ||
base: develop | ||
branch: automation/models | ||
body: ${{ steps.vars.outputs.pr_body }} | ||
add-paths: | | ||
Adyen/Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ TestResults/ | |
.vagrant/ | ||
.idea/ | ||
*.user | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
/* | ||
* ###### | ||
* ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
|
||
// | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
|
||
// | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
// /* | ||
// * ###### | ||
// * ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
/* | ||
* ###### | ||
* ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
// /* | ||
// * ###### | ||
// * ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
/* | ||
* ###### | ||
* ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
|
||
// | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
|
||
// | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region Licence | ||
#region Licence | ||
|
||
// | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#region License | ||
#region License | ||
// | ||
// ###### | ||
// ###### | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
openapi-generator-version:=6.2.1 | ||
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:=target/openapi-generator-cli.jar | ||
openapi-generator-cli:=java -jar $(openapi-generator-jar) | ||
|
||
|
||
generator:=csharp | ||
services:= | ||
models:=Adyen/Model | ||
output:=target/out | ||
|
||
# Generate models (for each service) | ||
models: $(services) | ||
|
||
Binlookup: spec=BinLookupService-v52 | ||
Checkout: spec=CheckoutService-v69 | ||
StoredValue: spec=StoredValueService-v46 | ||
TerminalManagement: spec=TfmAPIService-v1 | ||
Payments: spec=PaymentService-v68 | ||
Recurring: spec=RecurringService-v68 | ||
Payouts: spec=PayoutService-v68 | ||
Management: spec=ManagementService-v1 | ||
LegalEntityManagement: spec=LegalEntityService-v2 | ||
BalancePlatform: spec=BalancePlatformService-v2 | ||
PlatformsAccount: spec=AccountService-v6 | ||
PlatformsFund: spec=FundService-v6 | ||
PlatformsNotificationConfiguration: spec=NotificationConfigurationService-v6 | ||
PlatformsHostedOnboardingPage: spec=HopService-v6 | ||
Transfer: spec=TransferService-v3 | ||
|
||
$(services): target/spec $(openapi-generator-jar) | ||
rm -rf $(models)/$@ $(output) | ||
$(openapi-generator-cli) generate \ | ||
-i target/spec/json/$(spec).json \ | ||
-g $(generator) \ | ||
-t templates/csharp \ | ||
-o $(output) \ | ||
--model-package $@ \ | ||
--reserved-words-mappings Version=Version \ | ||
--global-property modelDocs=false \ | ||
--global-property modelTests=false \ | ||
--global-property models,supportingFiles \ | ||
--additional-properties packageName=Adyen.Model | ||
mkdir Adyen/Model/$@ | ||
mv target/out/src/Adyen.Model/$@/* Adyen/Model/$@ | ||
#adjust this build/src to another file when creating templates | ||
|
||
# Checkout spec (and patch version) | ||
target/spec: | ||
git clone https://github.com/Adyen/adyen-openapi.git target/spec | ||
perl -i -pe 's/"openapi" : "3.[0-9].[0-9]"/"openapi" : "3.0.0"/' target/spec/json/*.json | ||
|
||
# Extract templates (copy them for modifications) | ||
templates: $(openapi-generator-jar) | ||
$(openapi-generator-cli) author template -g $(generator) -o target/templates | ||
|
||
# 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: | ||
rm -rf $(output) | ||
git checkout $(models) | ||
git clean -f -d $(models) | ||
|
||
|
||
.PHONY: templates models $(services) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{{>partial_header}} | ||
using System; | ||
using System.Linq; | ||
using System.IO; | ||
using System.Text; | ||
{{^netStandard}} | ||
using System.Text.RegularExpressions; | ||
{{/netStandard}} | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Runtime.Serialization; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Converters; | ||
{{#models}} | ||
{{#model}} | ||
{{#discriminator}} | ||
using JsonSubTypes; | ||
{{/discriminator}} | ||
{{/model}} | ||
{{/models}} | ||
{{^netStandard}} | ||
{{#generatePropertyChanged}} | ||
using PropertyChanged; | ||
using System.ComponentModel; | ||
{{/generatePropertyChanged}} | ||
using System.ComponentModel.DataAnnotations; | ||
{{/netStandard}} | ||
using OpenAPIDateConverter = {{packageName}}.Client.OpenAPIDateConverter; | ||
|
||
namespace {{packageName}}.{{modelPackage}} | ||
{ | ||
{{#models}} | ||
{{#model}} | ||
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}} | ||
{{/model}} | ||
{{/models}} | ||
} |