From 873add9a6f3f96c1cbed4fbcabe20b0830f8e97b Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 19 Jun 2023 15:06:25 +0200 Subject: [PATCH 01/25] update README (#143) * Add SwaggerEditor link to Readme --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e459894..21eb136 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![SFTI_Banner](https://user-images.githubusercontent.com/116151702/232762217-ac254483-0d25-4234-857b-376ff8dbb1e7.png) + ![ca-mortgage](https://user-images.githubusercontent.com/116151702/236231740-68b1595a-3cf7-4c5c-9623-3e014d827436.png) @@ -9,3 +9,6 @@ [![GitHub license](https://img.shields.io/github/license/swissfintechinnovations/ca-mortgage)](https://github.com/swissfintechinnovations/ca-mortgage/blob/main/LICENSE) This is the official SFTI repo for the mortgage API. Documentations may be found in the [Wiki](https://github.com/swissfintechinnovations/ca-mortgage/wiki). + +An easy-to-read representation of the Mortgage API is accessible via the following link: +- [Mortgage API](https://editor.swagger.io/?url=https://raw.githubusercontent.com/swissfintechinnovations/ca-mortgage/main/mortgageAPI.yaml) \ No newline at end of file From 9ba7fc3b97dc66d324c648df5313eccb8a7f8a86 Mon Sep 17 00:00:00 2001 From: celinevananraad <121175253+celinevananraad@users.noreply.github.com> Date: Thu, 20 Jul 2023 10:32:10 +0200 Subject: [PATCH 02/25] new enums for Wuest new enums for Wuest (heatProduction) --- mortgageAPI.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 28cfc27..89ddcc5 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -1843,12 +1843,18 @@ components: enum: - oil - gas + - biogas - wood - electric - geothermal_probe + - heat_pump_water_water + - heat_pump_air_water - district + - district_fossil - solar_panel - solar_thermal_collector + - block_type_thermal_power_station + - block_type_thermal_power_station_bio description: Type of the heat production example: gas outsideConstructionZone: From 8bd533611113357c338e8cec28a88f5d07a7fb67 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 25 Aug 2023 14:41:56 +0200 Subject: [PATCH 03/25] add release action (#146) --- .github/workflows/release.yaml | 300 +++++++++++++++++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..46702b9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,300 @@ +name: Release Pipeline + +on: + workflow_dispatch: + inputs: + version: + description: "Release version tag (required format: v[mayor].[minor].[bugfix], e.g. v1.3.0)" + type: string + required: true + draft: + description: Should a release draft be created? (Otherwise the release will be published immediately) + type: boolean + default: true + required: true + artifact: + description: Add artifacts to the release. All files from /docs are added to the release. + type: boolean + default: true + required: false + force: + description: "If force is true, already published releases can be overwritten. Caution: This action deletes already published releases and can **not** be undone!" + type: boolean + required: false + +jobs: + release: + runs-on: ubuntu-latest + + permissions: + contents: write + pull-requests: write + + steps: + - name: Validate input parameters and check user permission + id: param_check + run: | + VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$" + version=${{ github.event.inputs.version }} + if [[ ! "$version" =~ $VERSION_REGEX ]]; then + echo "Invalid version format: $version . Please provide a version matching the pattern 'v[number].[number].[number]'." + exit 1 + fi + + if [[ "${{ github.actor }}" != "dkoeni" && "${{ github.actor }}" != "rolfwagner" && "${{ github.actor }}" != "michschl" && "${{ github.actor }}" != "juergen-petry" ]]; then + echo "You have no permissons to start the release action." + exit 1 + fi + + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Checkout Wiki + uses: actions/checkout@v3 + with: + repository: ${{github.repository}}.wiki + path: wiki + + - name: Extract variables for Release # Adjust names only here + id: var + run: | + version=$(echo ${{ github.event.inputs.version }} | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') # alternative: '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]' + repo_name=$( echo ${{ github.repository }} | sed -E "s/^.*\///" ) + echo "VERSION"=$version >> $GITHUB_OUTPUT + echo "RELEASE_NAME=$repo_name Release $version" >> $GITHUB_OUTPUT + echo "RELEASE_TAG=v$version" >> $GITHUB_OUTPUT + echo "RELEASE_BRANCH=main" >> $GITHUB_OUTPUT + echo "RELEASE_NOTES=RELEASE.md" >> $GITHUB_OUTPUT + echo "RELEASE_ASSETS_FOLDER=docs/" >> $GITHUB_OUTPUT + echo "RELEASE_ASSETS_NAME=artifact" >> $GITHUB_OUTPUT + + - name: Get release note content from wiki + id: release_note_body + run: | + regex="### Release ${{ steps.var.outputs.RELEASE_TAG }}[[:space:]]*[[:print:]]*[[:cntrl:]]{2}([[:print:]]+[[:space:]])*" + content=$(grep -ozE "$regex" wiki/Release-Roadmap.md | tr "\0" "\n" | tail -n +3) + # abort if content is empty --> wiki page must be present before release + if [ -z "$content" ]; then + echo "Found no data for ${{ steps.var.outputs.RELEASE_NAME }} at wiki/Release Roadmap (${{ github.repository }}). Please create a section <> and fill in details for the release by following the instructions at the .github Wiki. A template can be found at https://github.com/swissfintechinnovations/.github/wiki/Release-Roadmap-Example." + exit 1 + fi + body="$content"$'\n\n# \n\n' + echo "BODY=${body//$'\n'/'\n'}" >> $GITHUB_OUTPUT + + - name: Check file version + id: check_version + run: | + BASE_BRANCH="${{ steps.var.outputs.RELEASE_BRANCH }}" + + git checkout -q origin/$BASE_BRANCH + release_version=${{ steps.var.outputs.VERSION }} + versions=$(grep -Eo 'version: [0-9]+\.[0-9]+\.[0-9]+' *.yaml | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') + versions_outdated='false' + for version in $versions; do + if [[ $version != $release_version ]]; then + versions_outdated='true' + break + fi + done + echo "VERSIONS_OUTDATED=$versions_outdated" >> $GITHUB_OUTPUT + + - name: Switch to release branch + id: create_release_branch + if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' + run: | + BASE_BRANCH="${{ steps.var.outputs.RELEASE_BRANCH }}" + BRANCH_NAME="release/${{ steps.var.outputs.VERSION }}" + + git config --global user.name "sfti bot" + git config --global user.email "github-bot@common-api.ch" + + git checkout -q origin/$BASE_BRANCH + git checkout $BRANCH_NAME 2>/dev/null || git checkout -b $BRANCH_NAME # checkout branch or create new one if not exists + + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT + + - name: Update version in files + id: update_version + if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' + run: | + VERSION="${{ steps.var.outputs.VERSION }}" + RELEASE_NAME="${{ steps.var.outputs.RELEASE_NAME }}" + BRANCH_NAME="${{ steps.create_release_branch.outputs.BRANCH_NAME }}" + + echo "Prepare Release $RELEASE_NAME: update version number in yaml files" + + sed -E -i "s/version: [0-9]+\.[0-9]+\.[0-9]+/version: $VERSION/" *.yaml + + git add -u . + # commit only if there was changes in the yaml files + git diff --staged --quiet || git commit -m "Automated version update" + # git commit --quiet --allow-empty -m '[skip-workflow]' + git push --quiet --set-upstream origin $BRANCH_NAME + + - name: "Rollback: Delete Branch" + if: failure() && steps.update_version.outcome == 'failure' + run: | + git checkout -q main + git branch -D ${{ steps.create_release_branch.outputs.BRANCH_NAME }} + git push origin --delete ${{ steps.create_release_branch.outputs.BRANCH_NAME }} + + - name: Create and merge Pull Request + id: create_pr + if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' + run: | + BASE_BRANCH=${{ steps.var.outputs.RELEASE_BRANCH }} + + response=$(gh pr create -B $BASE_BRANCH -H ${{ steps.create_release_branch.outputs.BRANCH_NAME }} --title 'Automated version update to version ${{ steps.var.outputs.VERSION }}' --body 'Created by Github action (release workflow)') + number=$(echo "$response" | grep -oE '[0-9]+$') # parse GitHub PR link to extract PR number + echo "PR_NUMBER=$number" >> $GITHUB_OUTPUT + + sleep 2 + + # gh pr review $number --approve # can not approve own PR + gh pr merge $number --admin --merge --delete-branch --body "Automated version update" # force merge since PR is not approved (--admin flag) + git checkout $BASE_BRANCH + env: + GITHUB_TOKEN: ${{ secrets.SFTI_BOT_TOKEN }} + + - name: "Rollback: Delete PR" + if: failure() && steps.create_pr.outcome == 'failure' + run: | + gh pr close ${{ steps.create_pr.outputs.PR_NUMBER }} -c "Couldn't merge PR automatically" --delete-branch + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Delete release (draft) if already exists + id: delete_release_draft + run: | + ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} + REPO_NAME=${{ github.repository }} + TAG=${{ steps.var.outputs.RELEASE_TAG }} + RELEASE_NAME="${{ steps.var.outputs.RELEASE_NAME }}" + + # Get the release ID belonging to the release tag + RELEASE_ID=$(curl -sS -X GET -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/$REPO_NAME/releases" | jq -r ".[] | select(.name == \"$RELEASE_NAME\") | .id") + + # RELEASE_ID var contains 0 or 1 IDs + if [[ ! $RELEASE_ID =~ ^[0-9]*$ ]]; then + echo "Found more than one release with name \"$RELEASE_ID\"." + exit 1 + fi + + is_draft=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID | jq '.draft') + + if [[ "$is_draft" == 'false' ]]; then + echo "Release is published." + if [[ ${{ github.event.inputs.force }} == true ]]; then + commit_id=$(git rev-list -n 1 "refs/tags/$TAG") + echo $commit_id + git tag -d $TAG + git push origin ":refs/tags/$TAG" + echo "Force Flag is set! Deleted tag $TAG at commit ID $commit_id." + fi + if [[ ${{ github.event.inputs.force }} == false ]]; then + echo "Release $TAG already exists. Please verify that the version entered is correct. Set the force flag to overwrite the release." + exit 1 + fi + fi + + if [[ -n "$RELEASE_ID" ]]; then + # Delete the existing release draft + curl -sS -X DELETE -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID" + echo "Deleted release \"$RELEASE_ID\" with ID $RELEASE_ID" + fi + + - name: Create release draft + id: create_release_draft + run: | + ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} + REPO_NAME=${{ github.repository }} + + RESPONSE=$(curl -sS -i -X POST \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$REPO_NAME/releases" \ + -d '{ + "tag_name": "'"${{ steps.var.outputs.RELEASE_TAG }}"'", + "target_commitish": "'"${{ steps.var.outputs.RELEASE_BRANCH }}"'", + "name": "'"${{ steps.var.outputs.RELEASE_NAME }}"'", + "name": "'"${{ steps.var.outputs.RELEASE_NAME }}"'", + "body": "'"${{ steps.release_note_body.outputs.BODY }}"'", + "generate_release_notes": true, + "draft": true + }') + + if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then + echo "Failed to create release draft. Received response from GitHub API:" + echo "" + echo "$RESPONSE" + exit 1 + fi + + echo "RELEASE_ID=$(echo $RESPONSE | grep -o -z '\{.*\}' | jq -r '.id')" >> $GITHUB_OUTPUT + + - name: Upload artifacts + id: upload_artifact + # ensure assert folder exsits and not empty otherwise skip step + if: github.event.inputs.artifact == 'true' && (hashFiles(steps.var.outputs.RELEASE_ASSETS_FOLDER) != '') + run: | + ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} + REPO_NAME=${{ github.repository }} + RELEASE_ID=${{ steps.create_release_draft.outputs.RELEASE_ID }} + RELEASE_ASSETS_FOLDER=${{ steps.var.outputs.RELEASE_ASSETS_FOLDER }} + RELEASE_ASSETS_NAME=${{ steps.var.outputs.RELEASE_ASSETS_NAME }} + + RELEASE_ASSETS_ZIP=$RELEASE_ASSETS_NAME.zip + RELEASE_ASSETS_TARGZ=$RELEASE_ASSETS_NAME.tar.gz + + zip -qr $RELEASE_ASSETS_ZIP $RELEASE_ASSETS_FOLDER + + RESPONSE=$(curl -sS -i -X POST \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + "https://uploads.github.com/repos/$REPO_NAME/releases/$RELEASE_ID/assets?name=$RELEASE_ASSETS_ZIP" \ + --data-binary "@$RELEASE_ASSETS_ZIP" ) + + if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then + echo "Failed to upload release asset $RELEASE_ASSETS_ZIP. Received response from GitHub API:" + echo "" + echo "$RESPONSE" + exit 1 + fi + + tar -czf $RELEASE_ASSETS_TARGZ $RELEASE_ASSETS_FOLDER + + RESPONSE=$(curl -sS -i -X POST -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/octet-stream" \ + --data-binary "@$RELEASE_ASSETS_TARGZ" \ + "https://uploads.github.com/repos/$REPO_NAME/releases/$RELEASE_ID/assets?name=$RELEASE_ASSETS_TARGZ") + + if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then + echo "Failed to upload release asset $RELEASE_ASSETS_TARGZ. Received response from GitHub API:" + echo "" + echo "$RESPONSE" + exit 1 + fi + + - name: Publish release + if: github.event.inputs.draft == 'false' + id: publish_release + run: | + ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} + REPO_NAME=${{ github.repository }} + RELEASE_ID=${{ steps.create_release_draft.outputs.RELEASE_ID }} + + RESPONSE=$(curl -sS -i -X PATCH \ + -H "Authorization: Bearer $ACCESS_TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID" \ + -d '{ + "prerelease": false, + "draft": false, + "make_latest": "true" + }') + + if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 200 ]]; then + echo "Failed to publish release. Received response from GitHub API:" + echo "" + echo "$RESPONSE" + exit 1 + fi From 8c95f2fad89e9cdabacbfd12897e477039758663 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 25 Aug 2023 14:45:06 +0200 Subject: [PATCH 04/25] add yamllint action (#147) --- .github/workflows/lint.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml new file mode 100644 index 0000000..0d727d9 --- /dev/null +++ b/.github/workflows/lint.yaml @@ -0,0 +1,31 @@ +name: Lint yaml-files + +on: + pull_request: + workflow_dispatch: + +jobs: + pr-yaml-lint: + runs-on: ubuntu-latest + steps: + - name: Checkout Lint Repo + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} # checkout last commit of PR instead of merge commit + + - name: Checkout Yamllint Config Repo + uses: actions/checkout@v3 + with: + repository: swissfintechinnovations/.github + path: .github + + # - name: Install yamllint + # run: pip install yamllint + + - name: get commit message + id: skip + run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B | tr -d '\n')" >> $GITHUB_OUTPUT # set last commit message as env file (since env var will be not supported) + + - name: Lint yaml APIs + if: "!contains(steps.skip.outputs.COMMIT_MESSAGE, '[skip-workflow]')" # check commit message via env var - skip step if [skip-workflow] is set + run: yamllint -c .github/workflows/.yamllint *.yaml From 04534de26c352dee3ed756b40d8301c173b4f2d8 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 25 Aug 2023 15:28:24 +0200 Subject: [PATCH 05/25] Release action (#148) * fix wiki name --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 46702b9..cffb28f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -72,10 +72,10 @@ jobs: id: release_note_body run: | regex="### Release ${{ steps.var.outputs.RELEASE_TAG }}[[:space:]]*[[:print:]]*[[:cntrl:]]{2}([[:print:]]+[[:space:]])*" - content=$(grep -ozE "$regex" wiki/Release-Roadmap.md | tr "\0" "\n" | tail -n +3) + content=$(grep -ozE "$regex" wiki/Roadmap.md | tr "\0" "\n" | tail -n +3) # abort if content is empty --> wiki page must be present before release if [ -z "$content" ]; then - echo "Found no data for ${{ steps.var.outputs.RELEASE_NAME }} at wiki/Release Roadmap (${{ github.repository }}). Please create a section <> and fill in details for the release by following the instructions at the .github Wiki. A template can be found at https://github.com/swissfintechinnovations/.github/wiki/Release-Roadmap-Example." + echo "Found no data for ${{ steps.var.outputs.RELEASE_NAME }} at wiki/Roadmap (${{ github.repository }}). Please create a section <> and fill in details for the release by following the instructions at the .github Wiki. A template can be found at https://github.com/swissfintechinnovations/.github/wiki/Roadmap-Example." exit 1 fi body="$content"$'\n\n# \n\n' From 7cf17b3e970f1db8800862f505a8d9360370eab1 Mon Sep 17 00:00:00 2001 From: sfti bot Date: Fri, 25 Aug 2023 13:32:29 +0000 Subject: [PATCH 06/25] Automated version update --- mortgageAPI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 28cfc27..94254a7 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -1,6 +1,6 @@ openapi: 3.0.0 info: - version: 3.3.0 + version: 3.4.1 title: Common Mortgage API (Public) description: > This specification defines a common mortgage API for mortgages as used in Switzerland. From 5d25c7499d046225d4fa30450c00d73f5b81f30b Mon Sep 17 00:00:00 2001 From: sfti bot Date: Tue, 29 Aug 2023 14:51:17 +0000 Subject: [PATCH 07/25] Automated version update --- mortgageAPI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index f6a401c..5a50818 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -1,6 +1,6 @@ openapi: 3.0.0 info: - version: 3.4.1 + version: 3.5.0 title: Common Mortgage API (Public) description: > This specification defines a common mortgage API for mortgages as used in Switzerland. From b70b120d0a79ed0692066512453cfbbbe8cecf1e Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:53:24 +0200 Subject: [PATCH 08/25] adjust CODEOWNERS file (#160) --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 22072aa..3a1b5b2 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,4 +4,4 @@ # The '*' pattern is global owners. # Order is important. The last matching pattern has the most precedence. -* @rolfwagner @dkoeni +* @swissfintechinnovations/stream-lead-mortgage From 534a7c8595825a460559b5f1a300c238c292d52f Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:56:14 +0200 Subject: [PATCH 09/25] Support links to images or other resources relevant to the real estate (#161) --- mortgageAPI.yaml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 5a50818..74b8a87 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -2139,6 +2139,11 @@ components: description: Date of public notarization remarks: type: string + propertyLinks: + description: A list of links to external resources related to the property + type: array + items: + $ref: '#/components/schemas/Link' PropertyIdentifier: description: Property identification (register of real estate) @@ -3199,6 +3204,27 @@ components: maximum: 1 example: 0.5 + Link: + description: Object containing a link to an external resource and its description + type: object + required: + - url + properties: + url: + description: The URL pointing to the resource + type: string + format: uri + minLength: 2 + example: http://www.example.com/property.png + name: + description: The name of the resource + type: string + example: Property image + description: + description: A description of the resource + type: string + example: The image shows the aerial view of the property + # ---- Global Common Header Parameters ---- parameters: path_caseId: From d45c3cad149ced728353867aa90ef688bba5a72f Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:57:09 +0200 Subject: [PATCH 10/25] Support for Advertiser information (#162) * Support for Advertiser information --- mortgageAPI.yaml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 74b8a87..0e8f20d 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -2503,6 +2503,54 @@ components: address: $ref: '#/components/schemas/structuredAddress' + Advertiser: + description: Information about the person or agency selling the property, in case it is applicable and known + type: object + required: + - name + properties: + advertiserType: + description: Specifies if the advertiser is a private person, a company or an agency + type: string + enum: + - private + - company + - agency + example: agency + name: + description: The name of the advertiser + type: string + maxLength: 140 + example: Real Estate Agency AG + contactPerson: + description: The person to contact in case the advertiser is an agency or a company + type: string + maxLength: 140 + example: Max Muster + language: + description: Preferred contact language of the advertiser + type: string + example: fr + enum: + - de + - fr + - it + - en + phone: + description: The number on which the advertiser can be reached + type: string + minLength: 4 + maxLength: 13 + example: +41443343456 + email: + description: The email address on which the advertiser can be contacted + type: string + format: email + minLength: 5 + example: max.muster@domain.ch + address: + $ref: '#/components/schemas/structuredAddress' + MortgageCase: description: A complete mortgage case including the application details type: object From 90419c0459a35d246938d8a49d8700ea1d3a1edf Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 16 Oct 2023 16:58:36 +0200 Subject: [PATCH 11/25] Change propertyObjectId's type to String (#163) * Change propertyObjectId's type to String to support different vendor identifiers --- mortgageAPI.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 0e8f20d..58ed9dc 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -1644,8 +1644,7 @@ components: properties: propertyObjectId: type: string - format: uuid - description: The property object identifier (UUID v4) defined by TPP. + description: The property object identifier defined by TPP. example: 9343dd26-4b54-4808-8978-538f8e869d0e name: type: string From eb81d6aa691a0ef0d354002e573a2070d679623b Mon Sep 17 00:00:00 2001 From: sfti bot Date: Mon, 16 Oct 2023 14:59:34 +0000 Subject: [PATCH 12/25] Automated version update --- mortgageAPI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 58ed9dc..dc0ba37 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -1,6 +1,6 @@ openapi: 3.0.0 info: - version: 3.5.0 + version: 3.6.0 title: Common Mortgage API (Public) description: > This specification defines a common mortgage API for mortgages as used in Switzerland. From 445fe52c51ea7643a067ea9d4717cc52f65b1b3d Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:28:51 +0100 Subject: [PATCH 13/25] upgrade actions/checkout@v3 -> v4 (#165) --- .github/workflows/lint.yaml | 6 +++--- .github/workflows/release.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0d727d9..b9a0a69 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Lint Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} # checkout last commit of PR instead of merge commit - name: Checkout Yamllint Config Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: swissfintechinnovations/.github path: .github @@ -27,5 +27,5 @@ jobs: run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B | tr -d '\n')" >> $GITHUB_OUTPUT # set last commit message as env file (since env var will be not supported) - name: Lint yaml APIs - if: "!contains(steps.skip.outputs.COMMIT_MESSAGE, '[skip-workflow]')" # check commit message via env var - skip step if [skip-workflow] is set + if: ${{ !contains(steps.skip.outputs.COMMIT_MESSAGE, '[skip-workflow]') }} # check commit message via env var - skip step if [skip-workflow] is set run: yamllint -c .github/workflows/.yamllint *.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index cffb28f..465b7e3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -47,10 +47,10 @@ jobs: fi - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Checkout Wiki - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{github.repository}}.wiki path: wiki From e4c5818dfa9a9f23ee769b34ffb04f66bce34e89 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:29:41 +0100 Subject: [PATCH 14/25] change release workflow permissions (#166) --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 465b7e3..363a3fa 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -41,7 +41,7 @@ jobs: exit 1 fi - if [[ "${{ github.actor }}" != "dkoeni" && "${{ github.actor }}" != "rolfwagner" && "${{ github.actor }}" != "michschl" && "${{ github.actor }}" != "juergen-petry" ]]; then + if [[ "${{ github.actor }}" != "NikolajMarwitz" && "${{ github.actor }}" != "dkoeni" && "${{ github.actor }}" != "juergen-petry" ]]; then echo "You have no permissons to start the release action." exit 1 fi From d5af87cbf64d342eba617a7dbaa39cf211e1bd7c Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 5 Jan 2024 09:54:25 +0100 Subject: [PATCH 15/25] Init reusable workflows (#168) --- .github/workflows/lint.yaml | 31 +--- .github/workflows/release.yaml | 280 ++------------------------------- 2 files changed, 18 insertions(+), 293 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b9a0a69..0881385 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,31 +1,12 @@ -name: Lint yaml-files +name: Lint yaml-files (reusable) on: pull_request: workflow_dispatch: jobs: - pr-yaml-lint: - runs-on: ubuntu-latest - steps: - - name: Checkout Lint Repo - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} # checkout last commit of PR instead of merge commit - - - name: Checkout Yamllint Config Repo - uses: actions/checkout@v4 - with: - repository: swissfintechinnovations/.github - path: .github - - # - name: Install yamllint - # run: pip install yamllint - - - name: get commit message - id: skip - run: echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B | tr -d '\n')" >> $GITHUB_OUTPUT # set last commit message as env file (since env var will be not supported) - - - name: Lint yaml APIs - if: ${{ !contains(steps.skip.outputs.COMMIT_MESSAGE, '[skip-workflow]') }} # check commit message via env var - skip step if [skip-workflow] is set - run: yamllint -c .github/workflows/.yamllint *.yaml + yaml-lint: + uses: swissfintechinnovations/.github/.github/workflows/reusable-yamllint-workflow.yaml@main + with: + filenames: '*.yaml' + fail: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 363a3fa..d819238 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Release Pipeline +name: Release Pipeline (reusable) on: workflow_dispatch: @@ -15,7 +15,7 @@ on: artifact: description: Add artifacts to the release. All files from /docs are added to the release. type: boolean - default: true + default: false required: false force: description: "If force is true, already published releases can be overwritten. Caution: This action deletes already published releases and can **not** be undone!" @@ -23,278 +23,22 @@ on: required: false jobs: - release: + check-permissions: runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: write - steps: - - name: Validate input parameters and check user permission + - name: Check user permission id: param_check run: | - VERSION_REGEX="^v[0-9]+\.[0-9]+\.[0-9]+$" - version=${{ github.event.inputs.version }} - if [[ ! "$version" =~ $VERSION_REGEX ]]; then - echo "Invalid version format: $version . Please provide a version matching the pattern 'v[number].[number].[number]'." - exit 1 - fi - if [[ "${{ github.actor }}" != "NikolajMarwitz" && "${{ github.actor }}" != "dkoeni" && "${{ github.actor }}" != "juergen-petry" ]]; then echo "You have no permissons to start the release action." exit 1 fi - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Checkout Wiki - uses: actions/checkout@v4 - with: - repository: ${{github.repository}}.wiki - path: wiki - - - name: Extract variables for Release # Adjust names only here - id: var - run: | - version=$(echo ${{ github.event.inputs.version }} | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') # alternative: '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]' - repo_name=$( echo ${{ github.repository }} | sed -E "s/^.*\///" ) - echo "VERSION"=$version >> $GITHUB_OUTPUT - echo "RELEASE_NAME=$repo_name Release $version" >> $GITHUB_OUTPUT - echo "RELEASE_TAG=v$version" >> $GITHUB_OUTPUT - echo "RELEASE_BRANCH=main" >> $GITHUB_OUTPUT - echo "RELEASE_NOTES=RELEASE.md" >> $GITHUB_OUTPUT - echo "RELEASE_ASSETS_FOLDER=docs/" >> $GITHUB_OUTPUT - echo "RELEASE_ASSETS_NAME=artifact" >> $GITHUB_OUTPUT - - - name: Get release note content from wiki - id: release_note_body - run: | - regex="### Release ${{ steps.var.outputs.RELEASE_TAG }}[[:space:]]*[[:print:]]*[[:cntrl:]]{2}([[:print:]]+[[:space:]])*" - content=$(grep -ozE "$regex" wiki/Roadmap.md | tr "\0" "\n" | tail -n +3) - # abort if content is empty --> wiki page must be present before release - if [ -z "$content" ]; then - echo "Found no data for ${{ steps.var.outputs.RELEASE_NAME }} at wiki/Roadmap (${{ github.repository }}). Please create a section <> and fill in details for the release by following the instructions at the .github Wiki. A template can be found at https://github.com/swissfintechinnovations/.github/wiki/Roadmap-Example." - exit 1 - fi - body="$content"$'\n\n# \n\n' - echo "BODY=${body//$'\n'/'\n'}" >> $GITHUB_OUTPUT - - - name: Check file version - id: check_version - run: | - BASE_BRANCH="${{ steps.var.outputs.RELEASE_BRANCH }}" - - git checkout -q origin/$BASE_BRANCH - release_version=${{ steps.var.outputs.VERSION }} - versions=$(grep -Eo 'version: [0-9]+\.[0-9]+\.[0-9]+' *.yaml | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - versions_outdated='false' - for version in $versions; do - if [[ $version != $release_version ]]; then - versions_outdated='true' - break - fi - done - echo "VERSIONS_OUTDATED=$versions_outdated" >> $GITHUB_OUTPUT - - - name: Switch to release branch - id: create_release_branch - if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' - run: | - BASE_BRANCH="${{ steps.var.outputs.RELEASE_BRANCH }}" - BRANCH_NAME="release/${{ steps.var.outputs.VERSION }}" - - git config --global user.name "sfti bot" - git config --global user.email "github-bot@common-api.ch" - - git checkout -q origin/$BASE_BRANCH - git checkout $BRANCH_NAME 2>/dev/null || git checkout -b $BRANCH_NAME # checkout branch or create new one if not exists - - echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT - - - name: Update version in files - id: update_version - if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' - run: | - VERSION="${{ steps.var.outputs.VERSION }}" - RELEASE_NAME="${{ steps.var.outputs.RELEASE_NAME }}" - BRANCH_NAME="${{ steps.create_release_branch.outputs.BRANCH_NAME }}" - - echo "Prepare Release $RELEASE_NAME: update version number in yaml files" - - sed -E -i "s/version: [0-9]+\.[0-9]+\.[0-9]+/version: $VERSION/" *.yaml - - git add -u . - # commit only if there was changes in the yaml files - git diff --staged --quiet || git commit -m "Automated version update" - # git commit --quiet --allow-empty -m '[skip-workflow]' - git push --quiet --set-upstream origin $BRANCH_NAME - - - name: "Rollback: Delete Branch" - if: failure() && steps.update_version.outcome == 'failure' - run: | - git checkout -q main - git branch -D ${{ steps.create_release_branch.outputs.BRANCH_NAME }} - git push origin --delete ${{ steps.create_release_branch.outputs.BRANCH_NAME }} - - - name: Create and merge Pull Request - id: create_pr - if: steps.check_version.outputs.VERSIONS_OUTDATED == 'true' - run: | - BASE_BRANCH=${{ steps.var.outputs.RELEASE_BRANCH }} - - response=$(gh pr create -B $BASE_BRANCH -H ${{ steps.create_release_branch.outputs.BRANCH_NAME }} --title 'Automated version update to version ${{ steps.var.outputs.VERSION }}' --body 'Created by Github action (release workflow)') - number=$(echo "$response" | grep -oE '[0-9]+$') # parse GitHub PR link to extract PR number - echo "PR_NUMBER=$number" >> $GITHUB_OUTPUT - - sleep 2 - - # gh pr review $number --approve # can not approve own PR - gh pr merge $number --admin --merge --delete-branch --body "Automated version update" # force merge since PR is not approved (--admin flag) - git checkout $BASE_BRANCH - env: - GITHUB_TOKEN: ${{ secrets.SFTI_BOT_TOKEN }} - - - name: "Rollback: Delete PR" - if: failure() && steps.create_pr.outcome == 'failure' - run: | - gh pr close ${{ steps.create_pr.outputs.PR_NUMBER }} -c "Couldn't merge PR automatically" --delete-branch - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Delete release (draft) if already exists - id: delete_release_draft - run: | - ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} - REPO_NAME=${{ github.repository }} - TAG=${{ steps.var.outputs.RELEASE_TAG }} - RELEASE_NAME="${{ steps.var.outputs.RELEASE_NAME }}" - - # Get the release ID belonging to the release tag - RELEASE_ID=$(curl -sS -X GET -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/$REPO_NAME/releases" | jq -r ".[] | select(.name == \"$RELEASE_NAME\") | .id") - - # RELEASE_ID var contains 0 or 1 IDs - if [[ ! $RELEASE_ID =~ ^[0-9]*$ ]]; then - echo "Found more than one release with name \"$RELEASE_ID\"." - exit 1 - fi - - is_draft=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID | jq '.draft') - - if [[ "$is_draft" == 'false' ]]; then - echo "Release is published." - if [[ ${{ github.event.inputs.force }} == true ]]; then - commit_id=$(git rev-list -n 1 "refs/tags/$TAG") - echo $commit_id - git tag -d $TAG - git push origin ":refs/tags/$TAG" - echo "Force Flag is set! Deleted tag $TAG at commit ID $commit_id." - fi - if [[ ${{ github.event.inputs.force }} == false ]]; then - echo "Release $TAG already exists. Please verify that the version entered is correct. Set the force flag to overwrite the release." - exit 1 - fi - fi - - if [[ -n "$RELEASE_ID" ]]; then - # Delete the existing release draft - curl -sS -X DELETE -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID" - echo "Deleted release \"$RELEASE_ID\" with ID $RELEASE_ID" - fi - - - name: Create release draft - id: create_release_draft - run: | - ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} - REPO_NAME=${{ github.repository }} - - RESPONSE=$(curl -sS -i -X POST \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/$REPO_NAME/releases" \ - -d '{ - "tag_name": "'"${{ steps.var.outputs.RELEASE_TAG }}"'", - "target_commitish": "'"${{ steps.var.outputs.RELEASE_BRANCH }}"'", - "name": "'"${{ steps.var.outputs.RELEASE_NAME }}"'", - "name": "'"${{ steps.var.outputs.RELEASE_NAME }}"'", - "body": "'"${{ steps.release_note_body.outputs.BODY }}"'", - "generate_release_notes": true, - "draft": true - }') - - if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then - echo "Failed to create release draft. Received response from GitHub API:" - echo "" - echo "$RESPONSE" - exit 1 - fi - - echo "RELEASE_ID=$(echo $RESPONSE | grep -o -z '\{.*\}' | jq -r '.id')" >> $GITHUB_OUTPUT - - - name: Upload artifacts - id: upload_artifact - # ensure assert folder exsits and not empty otherwise skip step - if: github.event.inputs.artifact == 'true' && (hashFiles(steps.var.outputs.RELEASE_ASSETS_FOLDER) != '') - run: | - ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} - REPO_NAME=${{ github.repository }} - RELEASE_ID=${{ steps.create_release_draft.outputs.RELEASE_ID }} - RELEASE_ASSETS_FOLDER=${{ steps.var.outputs.RELEASE_ASSETS_FOLDER }} - RELEASE_ASSETS_NAME=${{ steps.var.outputs.RELEASE_ASSETS_NAME }} - - RELEASE_ASSETS_ZIP=$RELEASE_ASSETS_NAME.zip - RELEASE_ASSETS_TARGZ=$RELEASE_ASSETS_NAME.tar.gz - - zip -qr $RELEASE_ASSETS_ZIP $RELEASE_ASSETS_FOLDER - - RESPONSE=$(curl -sS -i -X POST \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -H "Content-Type: application/octet-stream" \ - "https://uploads.github.com/repos/$REPO_NAME/releases/$RELEASE_ID/assets?name=$RELEASE_ASSETS_ZIP" \ - --data-binary "@$RELEASE_ASSETS_ZIP" ) - - if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then - echo "Failed to upload release asset $RELEASE_ASSETS_ZIP. Received response from GitHub API:" - echo "" - echo "$RESPONSE" - exit 1 - fi - - tar -czf $RELEASE_ASSETS_TARGZ $RELEASE_ASSETS_FOLDER - - RESPONSE=$(curl -sS -i -X POST -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/octet-stream" \ - --data-binary "@$RELEASE_ASSETS_TARGZ" \ - "https://uploads.github.com/repos/$REPO_NAME/releases/$RELEASE_ID/assets?name=$RELEASE_ASSETS_TARGZ") - - if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 201 ]]; then - echo "Failed to upload release asset $RELEASE_ASSETS_TARGZ. Received response from GitHub API:" - echo "" - echo "$RESPONSE" - exit 1 - fi - - - name: Publish release - if: github.event.inputs.draft == 'false' - id: publish_release - run: | - ACCESS_TOKEN=${{ secrets.GITHUB_TOKEN }} - REPO_NAME=${{ github.repository }} - RELEASE_ID=${{ steps.create_release_draft.outputs.RELEASE_ID }} - - RESPONSE=$(curl -sS -i -X PATCH \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/$REPO_NAME/releases/$RELEASE_ID" \ - -d '{ - "prerelease": false, - "draft": false, - "make_latest": "true" - }') - - if [[ $(echo $RESPONSE | head -n 1 | cut -d$' ' -f2 ) -ne 200 ]]; then - echo "Failed to publish release. Received response from GitHub API:" - echo "" - echo "$RESPONSE" - exit 1 - fi + release: + needs: check-permissions + uses: swissfintechinnovations/.github/.github/workflows/reusable-release-workflow.yaml@main + with: + version: ${{ github.event.inputs.version }} + draft: ${{ fromJSON(github.event.inputs.draft) }} + artifact: ${{ fromJSON(github.event.inputs.artifact) }} + force: ${{ fromJSON(github.event.inputs.force) }} From 0eea0b5d22a3c4381173c4bea3a09de0239c40bb Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 22 Jan 2024 14:56:04 +0100 Subject: [PATCH 16/25] Update license (#169) * update license * init license workflow --- .github/workflows/license-update.yaml | 8 ++++++++ LICENSE | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/license-update.yaml diff --git a/.github/workflows/license-update.yaml b/.github/workflows/license-update.yaml new file mode 100644 index 0000000..2316981 --- /dev/null +++ b/.github/workflows/license-update.yaml @@ -0,0 +1,8 @@ +name: Update copyright year in license file +on: + schedule: + - cron: "0 3 1 1 *" # 03:00 AM on January 1 + +jobs: + yaml-lint: + uses: swissfintechinnovations/.github/.github/workflows/reusable-license-update-workflow.yaml@main \ No newline at end of file diff --git a/LICENSE b/LICENSE index f8d1dde..83a97f4 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2023 SFTI + Copyright 2019-2024 SFTI Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. From 2dbaf4752515e4bb28f9c8d31d6ba42d71c0e602 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:00:08 +0100 Subject: [PATCH 17/25] add secrets to workflow call (#172) --- .github/workflows/lint.yaml | 4 ++-- .github/workflows/release.yaml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 0881385..21e7c1d 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -8,5 +8,5 @@ jobs: yaml-lint: uses: swissfintechinnovations/.github/.github/workflows/reusable-yamllint-workflow.yaml@main with: - filenames: '*.yaml' - fail: true + filenames: '*.yaml' + fail: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d819238..3a2dd09 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -42,3 +42,4 @@ jobs: draft: ${{ fromJSON(github.event.inputs.draft) }} artifact: ${{ fromJSON(github.event.inputs.artifact) }} force: ${{ fromJSON(github.event.inputs.force) }} + secrets: inherit \ No newline at end of file From e842cedd7205e7c3f83638f64039314a294690e0 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Mon, 25 Mar 2024 14:09:05 +0100 Subject: [PATCH 18/25] update workflows (#173) --- .github/workflows/license-update.yaml | 7 ++++--- .github/workflows/lint-openapi.yaml | 16 ++++++++++++++++ .github/workflows/lint-yaml.yaml | 16 ++++++++++++++++ .github/workflows/lint.yaml | 12 ------------ .github/workflows/release.yaml | 8 ++++---- 5 files changed, 40 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/lint-openapi.yaml create mode 100644 .github/workflows/lint-yaml.yaml delete mode 100644 .github/workflows/lint.yaml diff --git a/.github/workflows/license-update.yaml b/.github/workflows/license-update.yaml index 2316981..1b75eca 100644 --- a/.github/workflows/license-update.yaml +++ b/.github/workflows/license-update.yaml @@ -1,8 +1,9 @@ -name: Update copyright year in license file +name: SFTI Update License + on: schedule: - cron: "0 3 1 1 *" # 03:00 AM on January 1 jobs: - yaml-lint: - uses: swissfintechinnovations/.github/.github/workflows/reusable-license-update-workflow.yaml@main \ No newline at end of file + yaml-lint: + uses: swissfintechinnovations/.github/.github/workflows/reusable-license-update-workflow.yaml@main \ No newline at end of file diff --git a/.github/workflows/lint-openapi.yaml b/.github/workflows/lint-openapi.yaml new file mode 100644 index 0000000..a10e982 --- /dev/null +++ b/.github/workflows/lint-openapi.yaml @@ -0,0 +1,16 @@ +name: 'SFTI Lint Specifications: OpenAPI Compliance' + +on: + pull_request: + workflow_dispatch: + inputs: + filenames: + type: string + default: '*.yaml' + description: 'Files to be linted (list of files sperated by a whitespace). Default: *.yaml' + +jobs: + openapi-lint: + uses: swissfintechinnovations/.github/.github/workflows/reusable-lint-openapi-workflow.yaml@main + with: + filenames: ${{ github.event.inputs.filenames || '*.yaml' }} \ No newline at end of file diff --git a/.github/workflows/lint-yaml.yaml b/.github/workflows/lint-yaml.yaml new file mode 100644 index 0000000..70ba44a --- /dev/null +++ b/.github/workflows/lint-yaml.yaml @@ -0,0 +1,16 @@ +name: 'SFTI Lint Specifications: Yaml Compliance' + +on: + pull_request: + workflow_dispatch: + inputs: + filenames: + type: string + default: '*.yaml' + description: 'Files to be linted (list of files sperated by a whitespace). Default: *.yaml' + +jobs: + yaml-lint: + uses: swissfintechinnovations/.github/.github/workflows/reusable-lint-yaml-workflow.yaml@main + with: + filenames: ${{ github.event.inputs.filenames || '*.yaml' }} diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml deleted file mode 100644 index 21e7c1d..0000000 --- a/.github/workflows/lint.yaml +++ /dev/null @@ -1,12 +0,0 @@ -name: Lint yaml-files (reusable) - -on: - pull_request: - workflow_dispatch: - -jobs: - yaml-lint: - uses: swissfintechinnovations/.github/.github/workflows/reusable-yamllint-workflow.yaml@main - with: - filenames: '*.yaml' - fail: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3a2dd09..d97434a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,4 +1,4 @@ -name: Release Pipeline (reusable) +name: SFTI Release on: workflow_dispatch: @@ -13,9 +13,9 @@ on: default: true required: true artifact: - description: Add artifacts to the release. All files from /docs are added to the release. - type: boolean - default: false + description: Add artifacts to the release. All files from the provided folder(s) are added to the release. Folders or files are seperated by a single whitespace (e.g. file.txt folder/). **Do not use docs/**. + type: string + default: '' required: false force: description: "If force is true, already published releases can be overwritten. Caution: This action deletes already published releases and can **not** be undone!" From e5cff8832dfb62d0dc4cc9e4582f57c04561b270 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 31 May 2024 16:09:57 +0200 Subject: [PATCH 19/25] Update CODEOWNERS --- .github/CODEOWNERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 3a1b5b2..794b208 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -4,4 +4,5 @@ # The '*' pattern is global owners. # Order is important. The last matching pattern has the most precedence. -* @swissfintechinnovations/stream-lead-mortgage +* @swissfintechinnovations/stream-lead-mortgage +.github/** @swissfintechinnovations/github-infrastructure From e9f46cc3556c0ead3b9ec62840a8a39a2df38eb8 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Tue, 4 Jun 2024 12:35:48 +0200 Subject: [PATCH 20/25] adjust parameter in release action --- .github/workflows/release.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d97434a..d243d5f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,7 +15,6 @@ on: artifact: description: Add artifacts to the release. All files from the provided folder(s) are added to the release. Folders or files are seperated by a single whitespace (e.g. file.txt folder/). **Do not use docs/**. type: string - default: '' required: false force: description: "If force is true, already published releases can be overwritten. Caution: This action deletes already published releases and can **not** be undone!" @@ -39,7 +38,7 @@ jobs: uses: swissfintechinnovations/.github/.github/workflows/reusable-release-workflow.yaml@main with: version: ${{ github.event.inputs.version }} - draft: ${{ fromJSON(github.event.inputs.draft) }} - artifact: ${{ fromJSON(github.event.inputs.artifact) }} - force: ${{ fromJSON(github.event.inputs.force) }} - secrets: inherit \ No newline at end of file + draft: ${{ fromJSON(github.event.inputs.draft) }} # convert string to boolean + artifact: ${{ github.event.inputs.artifact }} + force: ${{ fromJSON(github.event.inputs.force) }} # convert string to boolean + secrets: inherit From 75c8f826c89fa854b3e0b104bb7cd25eb92b8fa5 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Fri, 5 Jul 2024 11:24:40 +0200 Subject: [PATCH 21/25] Update readme (#175) * added swagger validate workflow * add more badges to readme.md --- .github/workflows/lint-openapi.yaml | 3 +++ .github/workflows/lint-yaml.yaml | 3 +++ .github/workflows/swagger-validator.yaml | 12 ++++++++++++ README.md | 11 ++++++----- mortgageAPI.yaml | 4 +--- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/swagger-validator.yaml diff --git a/.github/workflows/lint-openapi.yaml b/.github/workflows/lint-openapi.yaml index a10e982..7fc732b 100644 --- a/.github/workflows/lint-openapi.yaml +++ b/.github/workflows/lint-openapi.yaml @@ -2,6 +2,9 @@ name: 'SFTI Lint Specifications: OpenAPI Compliance' on: pull_request: + push: + branches: + - main workflow_dispatch: inputs: filenames: diff --git a/.github/workflows/lint-yaml.yaml b/.github/workflows/lint-yaml.yaml index 70ba44a..0b824a4 100644 --- a/.github/workflows/lint-yaml.yaml +++ b/.github/workflows/lint-yaml.yaml @@ -2,6 +2,9 @@ name: 'SFTI Lint Specifications: Yaml Compliance' on: pull_request: + push: + branches: + - main workflow_dispatch: inputs: filenames: diff --git a/.github/workflows/swagger-validator.yaml b/.github/workflows/swagger-validator.yaml new file mode 100644 index 0000000..6d550fd --- /dev/null +++ b/.github/workflows/swagger-validator.yaml @@ -0,0 +1,12 @@ +name: SFTI Validate Swagger + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + swagger-validate: + uses: swissfintechinnovations/.github/.github/workflows/reusable-swagger-validate-workflow.yaml@main \ No newline at end of file diff --git a/README.md b/README.md index 21eb136..8f6a16e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ ![ca-mortgage](https://user-images.githubusercontent.com/116151702/236231740-68b1595a-3cf7-4c5c-9623-3e014d827436.png) - --- -[![GitHub release](https://img.shields.io/github/release/swissfintechinnovations/ca-mortgage)](https://github.com/swissfintechinnovations/ca-mortgage/releases/) -![GitHub checks](https://img.shields.io/github/checks-status/swissfintechinnovations/ca-mortgage/main) -![Swagger Validator](https://img.shields.io/swagger/valid/3.0?specUrl=https%3A%2F%2Fraw.githubusercontent.com%2FOAI%2FOpenAPI-Specification%2Fmaster%2Fexamples%2Fv2.0%2Fjson%2Fpetstore-expanded.json) -[![GitHub license](https://img.shields.io/github/license/swissfintechinnovations/ca-mortgage)](https://github.com/swissfintechinnovations/ca-mortgage/blob/main/LICENSE) +[![GitHub release](https://img.shields.io/github/release/swissfintechinnovations/ca-mortgage?color=blue)](https://github.com/swissfintechinnovations/ca-mortgage/releases/) +[![GitHub Action Status OpenAPI](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/lint-openapi.yaml?branch=main&label=openapi%20checks)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/lint-openapi.yaml) +[![GitHub Action Status Yaml](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/lint-yaml.yaml?branch=main&label=yaml%20checks)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/lint-yaml.yaml) +[![GitHub Action Status Swagger Validator](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/swagger-validator.yaml?branch=main&label=swagger%20validation)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/swagger-validator.yaml) +[![OpenAPI version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fgithub.com%2Fswissfintechinnovations%2Fca-mortgage%2Fraw%2Fmain%2FmortgageAPI.yaml&query=openapi&prefix=v&label=OpenAPI&color=blue)](https://swagger.io/resources/open-api/) +[![GitHub license](https://img.shields.io/github/license/swissfintechinnovations/ca-mortgage?color=de980d)](https://github.com/swissfintechinnovations/ca-mortgage/blob/main/LICENSE) This is the official SFTI repo for the mortgage API. Documentations may be found in the [Wiki](https://github.com/swissfintechinnovations/ca-mortgage/wiki). diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index dc0ba37..c0a6daa 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -333,7 +333,7 @@ paths: post: summary: Place a new mortgage application (serves as dossier) description: | - Place a new application including all necessary information about the property and applicant's financial situation. + Place a new application including all necessary information about the property and applicant's financial situation. **Note that in the case where the FI needs additional information on the property, the error response 400 must contain the minimum required JSON object (PropertyObject) as detail**. tags: - Mortgage Application @@ -3456,7 +3456,6 @@ components: type: string example: f058ebd6-02f7-4d3f-942e-904344e8cde5 - # ---- Responses - Standard---- responses: standard201: description: created @@ -3586,4 +3585,3 @@ components: application/problem+json: schema: $ref: '#/components/schemas/commonErrorResponse' - # ---- End Responses - Standard From 5ffd508cfcea927c215b64de68b351be4d41bc08 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Sat, 13 Jul 2024 12:02:08 +0200 Subject: [PATCH 22/25] Update README.md --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8f6a16e..69f7d71 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,15 @@ --- [![GitHub release](https://img.shields.io/github/release/swissfintechinnovations/ca-mortgage?color=blue)](https://github.com/swissfintechinnovations/ca-mortgage/releases/) +![Mortgage Major Version](https://img.shields.io/badge/major_version-v3-blue) +[![OpenAPI version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fgithub.com%2Fswissfintechinnovations%2Fca-mortgage%2Fraw%2Fmain%2FmortgageAPI.yaml&query=openapi&prefix=v&label=OpenAPI&color=blue)](https://swagger.io/resources/open-api/) +[![GitHub license](https://img.shields.io/github/license/swissfintechinnovations/ca-mortgage?color=de980d)](https://github.com/swissfintechinnovations/ca-mortgage/blob/main/LICENSE) + [![GitHub Action Status OpenAPI](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/lint-openapi.yaml?branch=main&label=openapi%20checks)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/lint-openapi.yaml) [![GitHub Action Status Yaml](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/lint-yaml.yaml?branch=main&label=yaml%20checks)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/lint-yaml.yaml) [![GitHub Action Status Swagger Validator](https://img.shields.io/github/actions/workflow/status/swissfintechinnovations/ca-mortgage/swagger-validator.yaml?branch=main&label=swagger%20validation)](https://github.com/swissfintechinnovations/ca-mortgage/actions/workflows/swagger-validator.yaml) -[![OpenAPI version](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fgithub.com%2Fswissfintechinnovations%2Fca-mortgage%2Fraw%2Fmain%2FmortgageAPI.yaml&query=openapi&prefix=v&label=OpenAPI&color=blue)](https://swagger.io/resources/open-api/) -[![GitHub license](https://img.shields.io/github/license/swissfintechinnovations/ca-mortgage?color=de980d)](https://github.com/swissfintechinnovations/ca-mortgage/blob/main/LICENSE) This is the official SFTI repo for the mortgage API. Documentations may be found in the [Wiki](https://github.com/swissfintechinnovations/ca-mortgage/wiki). An easy-to-read representation of the Mortgage API is accessible via the following link: -- [Mortgage API](https://editor.swagger.io/?url=https://raw.githubusercontent.com/swissfintechinnovations/ca-mortgage/main/mortgageAPI.yaml) \ No newline at end of file +- [Mortgage API](https://editor.swagger.io/?url=https://raw.githubusercontent.com/swissfintechinnovations/ca-mortgage/main/mortgageAPI.yaml) From 8911faa4b6fea209dfc801000418264cb30c6e90 Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Wed, 18 Sep 2024 16:00:22 +0200 Subject: [PATCH 23/25] Fix line length (#176) * add line breaks according to yaml linting rules --- mortgageAPI.yaml | 93 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index c0a6daa..23ab517 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -334,7 +334,9 @@ paths: summary: Place a new mortgage application (serves as dossier) description: | Place a new application including all necessary information about the property and applicant's financial situation. - **Note that in the case where the FI needs additional information on the property, the error response 400 must contain the minimum required JSON object (PropertyObject) as detail**. + + **Note that in the case where the FI needs additional information on the property, the error response 400 must contain + the minimum required JSON object (PropertyObject) as detail**. tags: - Mortgage Application parameters: @@ -448,7 +450,9 @@ paths: put: summary: Update the application's details - description: Update the application's details. Note that changing the application's details should not be possible after the application has been accepted by the FI. + description: > + Update the application's details. Note that changing the application's details should not be possible after the application + has been accepted by the FI. tags: - Mortgage Application parameters: @@ -537,7 +541,8 @@ paths: /mortgages/applications/{applicationId}/swissrets: post: summary: Add property details in the SwissRETS standard - description: This endpoint allows to upload the real estate property's details as an XML file in the SwissRETS format according to https://swissrets.ch/. + description: > + This endpoint allows to upload the real estate property's details as an XML file in the SwissRETS format according to https://swissrets.ch/. tags: - Mortgage Application parameters: @@ -1636,7 +1641,9 @@ components: # ---- End Common Data Model PropertyObject: - description: The representation of a real estate object, real estate register id (propertyIdentifier) is optional until otherwise required by law + description: > + The representation of a real estate object, real estate register id (propertyIdentifier) is optional + until otherwise required by law. type: object required: - propertyObjectId @@ -1696,7 +1703,9 @@ components: - interior_fittings - building_envelope - building_services - description: Type of Property Component which has been renovated. Please use consistently either the detailed Component Types (e.g. interior_fittings_floor_cover) or the simple Component Types (e.g. interior_fittings) + description: > + Type of Property Component which has been renovated. Please use consistently either the detailed Component types + (e.g. interior_fittings_floor_cover) or the simple Component Types (e.g. interior_fittings). example: interior_fittings_floor_cover yearOfRenovation: type: integer @@ -1737,7 +1746,16 @@ components: - 0 - 0.5 - 1.0 - description: 'Used for object value calculation (e.g. IAZI) and indicates whether an object is luxury or not: 0 = No, 0.5 = Partially, 1 = Yes. Proposed Mapping of WuP-Values: 1.0-4.0 => 0 (No) / 4.1-4.5 => 0.5 (Partially) / 4.6-5.0 = >1.0 (Yes).' + description: | + Used for object value calculation (e.g. IAZI) and indicates whether an object is luxury or not: + - 0 = No + - 0.5 = Partially + - 1 = Yes + + Proposed Mapping of WuP-Values: + - 1.0-4.0 => 0 (No) + - 4.1-4.5 => 0.5 (Partially) + - 4.6-5.0 => 1.0 (Yes) example: 0 constructionQualityType: $ref: '#/components/schemas/PropertyObjectRatingType' @@ -1768,7 +1786,8 @@ components: enum: - self - let - description: 'The type of usage of the financing property: self, let' + description: > + The type of usage of the financing property: self, let example: self propertyType: type: string @@ -1884,7 +1903,8 @@ components: example: kitchen_full_room numberOfFamilyBathrooms: type: integer - description: 'Separate shower and bathtub in the bathroom (optional: toilet)' + description: > + Separate shower and bathtub in the bathroom (optional: toilet) example: 2 numberOfBathWC: type: integer @@ -2108,7 +2128,9 @@ components: properties: estimationId: type: string - description: ID of the property estimation to connect the done estimation in the core banking system with the estimation of the tpp in the external estimation tool. + description: > + ID of the property estimation to connect the done estimation in the core banking system with the estimation of the tpp in the external + estimation tool. example: asd23f estimationSourceType: type: string @@ -2184,7 +2206,9 @@ components: $ref: '#/components/schemas/Date' offerDate: $ref: '#/components/schemas/Date' - description: The date when the offer is made by the FI. Optional field for use cases where no MortageOffer object is used and therefore the offer date needs to be directly in Mortgage object. + description: > + The date when the offer is made by the FI. Optional field for use cases where no MortageOffer object is used and + therefore the offer date needs to be directly in Mortgage object. example: 2018-04-05 validTo: $ref: '#/components/schemas/Date' @@ -2397,7 +2421,9 @@ components: example: 576f8de3-6b30-4882-a7af-da2132a456cf fiPrimaryApplicantId: type: string - description: ApplicantId for primary applicant of the applicant party defined by the financial institute, only applicable in case of multiple applicants and if known at the moment of the application. + description: > + ApplicantId for primary applicant of the applicant party defined by the financial institute, only applicable in case of multiple + applicants and if known at the moment of the application. example: asd23f personList: type: array @@ -2443,7 +2469,8 @@ components: example: advisor replacementType: type: string - description: 'NOT required when mortgage type is BUY, Values: entire, partial.' + description: > + NOT required when mortgage type is BUY, Values: entire, partial. example: entire enum: - entire @@ -2730,7 +2757,9 @@ components: example: 576f8de3-6b30-4882-a7af-da2132a456cf fiApplicantId: type: string - description: ApplicantId of the applicant party defined by the financial institute, only applicable if known at the moment of the application. + description: > + ApplicantId of the applicant party defined by the financial institute, + only applicable if known at the moment of the application. example: asd23f applicantType: type: string @@ -2980,7 +3009,8 @@ components: - withdraw Asset: - description: 'Asset information: Array of all assets the applicant possesses, incl. the assets which will be used for the financial request.' + description: > + Asset information: Array of all assets the applicant possesses, incl. the assets which will be used for the financial request. type: object required: - assetType @@ -2990,7 +3020,9 @@ components: $ref: '#/components/schemas/AssetType' amount: $ref: '#/components/schemas/Amount' - description: The amount of the asset e.g. market value of fungible investment, existing retirement asset in pension fund, surrender value in life insurance + description: > + The amount of the asset e.g. market value of fungible investment, existing retirement asset in pension fund, + surrender value in life insurance insuranceSum: $ref: '#/components/schemas/Amount' description: The amount of the sum insured in life insurance @@ -3000,7 +3032,9 @@ components: $ref: '#/components/schemas/AssetProvider' UsedAsset: - description: 'Asset used by an applicant: Array of all assets which will be used for the financial request. At least, all of these used assets must also be recorded in the array of assets in the financial situation of one applicant.' + description: > + Asset used by an applicant: Array of all assets which will be used for the financial request. At least, + all of these used assets must also be recorded in the array of assets in the financial situation of one applicant. type: object required: - assetType @@ -3199,7 +3233,9 @@ components: example: IE12BOFI90000112345678 AssetProvider: - description: Asset provider for each asset, additional information must be transfered. E.g. in case the applicant owns an addtional security of type insurance, insurance company name is provided + description: > + Asset provider for each asset, additional information must be transfered. E.g. in case the applicant owns an addtional security of type + insurance, insurance company name is provided type: object required: - name @@ -3239,7 +3275,9 @@ components: currentRate: type: number format: double - description: Interest reate in decimals. 2.45% would be sent as 0.0245. For flexible interest mortgage this would show the margin above interest.Base + description: > + Interest reate in decimals. 2.45% would be sent as 0.0245. For flexible interest mortgage this would show + the margin above interest. minimum: 0 maximum: 1 example: 0.5 @@ -3359,7 +3397,8 @@ components: in: header schema: type: string - description: 'ID of the client forwarded to the provider. (SCOPE: FI)' + description: > + ID of the client forwarded to the provider. (SCOPE: FI) required: true correlation_in_header: @@ -3468,7 +3507,9 @@ components: schema: type: string format: uri - description: In the location header of the response you will find the URI of the newly created resource. With a GET call to this address you can retrieve a representation of the new product. + description: > + In the location header of the response you will find the URI of the newly created resource. + With a GET call to this address you can retrieve a representation of the new product. X-Correlation-ID: schema: type: string @@ -3482,7 +3523,9 @@ components: $ref: '#/components/headers/Content-Language' X-Correlation-ID: $ref: '#/components/headers/X-Correlation-ID' - description: Bad Request - The server cannot or will not process the request due to something that is perceived to be a client error as malformed request syntax. + description: > + Bad Request - The server cannot or will not process the request due to something that is perceived to be + a client error as malformed request syntax. content: application/problem+json: schema: @@ -3524,7 +3567,9 @@ components: $ref: '#/components/headers/Content-Language' X-Correlation-ID: $ref: '#/components/headers/X-Correlation-ID' - description: Not Found - The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. + description: > + Not Found - The origin server did not find a current representation for the target resource or + is not willing to disclose that one exists. content: application/problem+json: schema: @@ -3538,7 +3583,9 @@ components: $ref: '#/components/headers/Content-Language' X-Correlation-ID: $ref: '#/components/headers/X-Correlation-ID' - description: Method Not Allowed - The method received in the request-line is known by the origin server but not supported by the target resource. + description: > + Method Not Allowed - The method received in the request-line is known by the origin server + but not supported by the target resource. content: application/problem+json: schema: From 89adc9805a19f5be0691568dae494cdb4a2da02f Mon Sep 17 00:00:00 2001 From: dkoeni <116151702+dkoeni@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:41:37 +0100 Subject: [PATCH 24/25] Naming conventions (#178) Adopted API spec to naming conventions --- .github/workflows/lint-openapi.yaml | 2 +- mortgageAPI.yaml | 541 ++++++++++++++++------------ 2 files changed, 306 insertions(+), 237 deletions(-) diff --git a/.github/workflows/lint-openapi.yaml b/.github/workflows/lint-openapi.yaml index 7fc732b..d21e4a2 100644 --- a/.github/workflows/lint-openapi.yaml +++ b/.github/workflows/lint-openapi.yaml @@ -16,4 +16,4 @@ jobs: openapi-lint: uses: swissfintechinnovations/.github/.github/workflows/reusable-lint-openapi-workflow.yaml@main with: - filenames: ${{ github.event.inputs.filenames || '*.yaml' }} \ No newline at end of file + filenames: ${{ github.event.inputs.filenames || '*.yaml' }} diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 23ab517..7a05714 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -11,29 +11,30 @@ info: email: info@common-api.ch license: name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html + url: https://www.apache.org/licenses/LICENSE-2.0.html servers: - url: https://mortgage.common-api.ch externalDocs: description: Find out more about SFTI API specifications url: https://www.common-api.ch + tags: - name: Full Mortgage Cases - description: Operatios related to full mortgage cases including the application details + description: Operations related to full mortgage cases including the application details. - name: Existing Mortgages - description: Operations related with existing mortgages + description: Operations related with existing mortgages. - name: Mortgage Products and Conditions - description: Operations for synchronizing general mortgage product information from an FI + description: Operations for synchronizing general mortgage product information from an FI. - name: Mortgage Application - description: Operations needed to place an application (dossier) for a new mortgage + description: Operations needed to place an application (dossier) for a new mortgage. - name: Mortgage Financing Request - description: Operations for handling financing requests for a specific accepted application (dossier) + description: Operations for handling financing requests for a specific accepted application (dossier). - name: Mortgage Offers - description: Operations for handling the binding offers an FI provides + description: Operations for handling the binding offers an FI provides. - name: Mortgage Order - description: Operations for placing a binding order for a chosen offer + description: Operations for placing a binding order for a chosen offer. - name: Mortgage Prolongation - description: Operations for handling the common special case of prolonging an existing mortgage + description: Operations for handling the common special case of prolonging an existing mortgage. security: - ApiKeyAuth: [] @@ -70,7 +71,7 @@ paths: items: $ref: '#/components/schemas/MortgageCase' _links: - $ref: '#/components/schemas/linksPagination' + $ref: '#/components/schemas/LinksPagination' '400': $ref: '#/components/responses/standard400' '401': @@ -140,8 +141,8 @@ paths: name: expiring schema: type: boolean - example: true description: Whether or not the mortgage is qualified for being prolonged, i.e., expiring soon or already expired (for filtering). + example: true - $ref: '#/components/parameters/limit' - $ref: '#/components/parameters/offset' - $ref: '#/components/parameters/clientid_in_header' @@ -163,7 +164,7 @@ paths: items: $ref: '#/components/schemas/Mortgage' _links: - $ref: '#/components/schemas/linksPagination' + $ref: '#/components/schemas/LinksPagination' '400': $ref: '#/components/responses/standard400' '401': @@ -230,7 +231,7 @@ paths: - Mortgage Products and Conditions parameters: - in: query - name: interestRateType + name: interest_rate_type schema: type: string example: saron @@ -262,7 +263,7 @@ paths: items: $ref: '#/components/schemas/Product' _links: - $ref: '#/components/schemas/linksPagination' + $ref: '#/components/schemas/LinksPagination' '400': $ref: '#/components/responses/standard400' '401': @@ -480,6 +481,7 @@ paths: properties: status: type: string + example: we need an example '400': $ref: '#/components/responses/standard400' '401': @@ -521,6 +523,7 @@ paths: reason: description: The reason for rejecting an application. type: string + example: We need an example '400': $ref: '#/components/responses/standard400' '401': @@ -643,6 +646,7 @@ paths: properties: status: type: string + example: we need an example '400': $ref: '#/components/responses/standard400' '401': @@ -779,6 +783,7 @@ paths: properties: status: type: string + example: pending enum: - accepted - rejected @@ -833,6 +838,7 @@ paths: properties: status: type: string + example: we need an example '400': $ref: '#/components/responses/standard400' '401': @@ -964,6 +970,7 @@ paths: financingRequestId: type: string format: uuid + example: 550e8400-e29b-41d4-a716-446655440000 documents: type: array items: @@ -1186,6 +1193,7 @@ paths: offerId: type: string format: uuid + example: 550e8400-e29b-41d4-a716-446655440000 documents: type: array items: @@ -1469,22 +1477,6 @@ paths: # -------- Models --------- # ------------------------- components: - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: X-API-Key - - OAuth2: - type: oauth2 - flows: - authorizationCode: - authorizationUrl: https://example.com/oauth/authorize - tokenUrl: https://example.com/oauth/token - scopes: - read: Grants read access - write: Grants write access - schemas: # ---- Common Data Model v1.2.0 # ---- Date Formats @@ -1492,48 +1484,50 @@ components: type: string format: date example: 2018-04-13 + description: Date format. DateTime: type: string format: date-time example: 2018-04-13T11:11:11Z + description: DateTime format. # ---- Links for Pagination---- - linksPagination: + LinksPagination: description: Links (or cursors) returned in the answer of an API call. type: object properties: self: type: string - description: Link / cursor to the current result set (based on the submitted pagination approach) + description: Link / cursor to the current result set (based on the submitted pagination approach). example: /mortgage-app/api/v1/products?offset=75&limit=25 first: type: string - description: Link / cursor to the first result set (based on the submitted pagination approach) + description: Link / cursor to the first result set (based on the submitted pagination approach). example: /mortgage-app/api/v1/products?offset=0&limit=25 previous: type: string - description: Link / cursor to the previous result set (based on the submitted pagination approach) + description: Link / cursor to the previous result set (based on the submitted pagination approach). example: /mortgage-app/api/v1/products?offset=50&limit=25 next: type: string - description: Link / cursor to the next result set (based on the submitted pagination approach) + description: Link / cursor to the next result set (based on the submitted pagination approach). example: /mortgage-app/api/v1/products?offset=100&limit=25 last: type: string - description: Link / cursor to the last result set (based on the submitted pagination approach) + description: Link / cursor to the last result set (based on the submitted pagination approach). example: /mortgage-app/api/v1/products?offset=150&limit=25 # ---- Currency ---- Currency: - description: ISO 4217 code + description: ISO 4217 code. type: string pattern: '^[A-Z]{3}$' example: CHF # ---- Amount ---- Amount: - description: amount with currency + description: amount with currency. type: object required: - currency @@ -1542,13 +1536,14 @@ components: currency: $ref: '#/components/schemas/Currency' content: - description: amount given with fractional digits, the separator is a dot + description: amount given with fractional digits, the separator is a dot. type: string pattern: '^-?\d{1,14}(?:\.\d{1,3})?$' - example: 235.45 + example: '235.45' # ---- Address compliant to payment address (b.Link & ISO20022)---- - structuredAddress: + StructuredAddress: + description: structured address. title: Structured Address type: object required: @@ -1561,63 +1556,71 @@ components: type: string maxLength: 70 example: Rue de la gare + description: Name of street. buildingNumber: type: string maxLength: 16 - example: 24 + example: 24A + description: number of building. postCode: type: string maxLength: 16 - example: 2501 + description: zip code. + example: CH-2501 townName: type: string maxLength: 35 example: Biel + description: you guessed it, the name of the town. country: type: string maxLength: 2 example: CH + description: a political area, surrounded by borders, very often a natural border such as a river or a mountain. # ---- Country Code ---- Country: type: string pattern: '^[A-Z]{2}$' example: CH - description: 2-Letter ISO 3166-2 Country Code + description: 2-Letter ISO 3166-2 Country Code. # ---- Response - commonResourceCreatedResponse: - title: Recource created response - description: Uuid v4 of the created resource - example: 20460121-6aff-485b-a61d-6056ecd72bd8 + CommonResourceCreatedResponse: + title: Resource created response + description: Uuid v4 of the created resource. type: object required: - id properties: id: $ref: '#/components/schemas/CommonID' - description: Uuid v4 of the created resource - example: bcb5d762-8d28-43a2-9398-393b2e8d56ba + description: Uuid v4 of the created resource. - commonErrorResponse: + CommonErrorResponse: title: Common Error Response + description: ... type: object properties: type: - $ref: '#/components/schemas/commonErrorType' + $ref: '#/components/schemas/CommonErrorType' title: type: string example: This is the general problem description + description: .. detail: + description: .. type: array items: type: string example: List of detailed problem description with respect to the current request + description: .. instance: type: string example: path/to/corresponding/resource + description: .. - commonErrorType: + CommonErrorType: title: Common Error Type description: Error Types for commonErrorResponse. type: string @@ -1655,10 +1658,10 @@ components: example: 9343dd26-4b54-4808-8978-538f8e869d0e name: type: string - description: User-defined property name + description: User-defined property name. example: My Nice Property address: - $ref: '#/components/schemas/structuredAddress' + $ref: '#/components/schemas/StructuredAddress' propertyIdentifier: $ref: '#/components/schemas/PropertyIdentifier' propertyConstructionInformation: @@ -1667,7 +1670,7 @@ components: properties: constructionYear: type: integer - description: construction year + description: construction year. example: 1990 renovation: type: boolean @@ -1675,7 +1678,7 @@ components: example: false renovationYear: type: integer - description: renovation year + description: renovation year. example: 1990 default: 0 propertyRenovations: @@ -1743,9 +1746,9 @@ components: luxusFlag: type: string enum: - - 0 - - 0.5 - - 1.0 + - '0' + - '0.5' + - '1.0' description: | Used for object value calculation (e.g. IAZI) and indicates whether an object is luxury or not: - 0 = No @@ -1779,7 +1782,7 @@ components: - efficient - average - inefficient - description: The efficiency of the floor plan + description: The efficiency of the floor plan. example: average usageType: type: string @@ -1806,7 +1809,7 @@ components: - office_building - industrial_building - special_object - description: The type of property + description: The type of property. example: single_family_house ceilingHight: type: string @@ -1844,6 +1847,7 @@ components: description: Building standard of the sanitary installations. example: basic heatEmission: + description: Type of the heat emission. type: array items: type: string @@ -1852,9 +1856,9 @@ components: - radiator - stove - other - description: Type of the heat emission example: floor heatProduction: + description: the way heat is generated within the building. type: array items: type: string @@ -1873,7 +1877,7 @@ components: - solar_thermal_collector - block_type_thermal_power_station - block_type_thermal_power_station_bio - description: Type of the heat production + description: Type of the heat production. example: gas outsideConstructionZone: type: boolean @@ -2094,6 +2098,7 @@ components: example: false buildingRight: type: object + description: if a property is in building right, the buyer owner buy the property, not the ground the property is built on. properties: hasBuildingRight: type: boolean @@ -2125,6 +2130,7 @@ components: description: The limit for land encumbrance according to Bundesgericht über das bäuerliche Bodenrecht, SR 211.412.11 (Belastungsgrenze BGBB) estimation: type: object + description: the estimation of the value of a property. properties: estimationId: type: string @@ -2140,13 +2146,13 @@ components: - wup marketValue: $ref: '#/components/schemas/Amount' - description: Estimated Market value of the property + description: Estimated Market value of the property. statisticalPriceRangeMax: $ref: '#/components/schemas/Amount' - description: Estimated statistical price range maximum + description: Estimated statistical price range maximum. statisticalPriceRangeMin: $ref: '#/components/schemas/Amount' - description: Estimated statistical price range minimum + description: Estimated statistical price range minimum. yearlyRentalIncome: $ref: '#/components/schemas/Amount' description: Estimated rental income per year @@ -2154,29 +2160,35 @@ components: $ref: '#/components/schemas/Date' transferOfOwnershipDate: $ref: '#/components/schemas/Date' - description: When the property will be fully transfered to the new owner + description: When the property will be fully transferred to the new owner. publicNotarization: $ref: '#/components/schemas/Date' description: Date of public notarization remarks: type: string + description: Remark regarding the estimation. + example: We need an example for such a remark propertyLinks: - description: A list of links to external resources related to the property + description: A list of links to external resources related to the property. type: array items: $ref: '#/components/schemas/Link' PropertyIdentifier: - description: Property identification (register of real estate) + description: Property identification (register of real estate). type: object properties: EGRID: type: string + example: CH480928387782 + description: Identifier of land a property is built on. EGID: type: string + example: '191092250' + description: Identifier of the property. Mortgage: - description: All relevant information regarding a specific mortgage + description: All relevant information regarding a specific mortgage. type: object required: - mortgageId @@ -2195,7 +2207,7 @@ components: type: string format: uuid example: 206065b9-977b-4d2c-9092-00acf2392346 - description: Uuid v4 of the specific mortgage + description: Uuid v4 of the specific mortgage. product: $ref: '#/components/schemas/Product' amountAtExpiry: @@ -2207,15 +2219,18 @@ components: offerDate: $ref: '#/components/schemas/Date' description: > - The date when the offer is made by the FI. Optional field for use cases where no MortageOffer object is used and + The date when the offer is made by the FI. Optional field for use cases where no MortgageOffer object is used and therefore the offer date needs to be directly in Mortgage object. example: 2018-04-05 validTo: $ref: '#/components/schemas/Date' interestRate: type: string + description: interest rate to be paid by debtor. + example: '1.4' interestRateType: type: string + description: type of interest rate. example: libor enum: - variable @@ -2224,6 +2239,8 @@ components: - fixed interestBasis: type: string + description: we need a description. + example: We need an example durationType: type: integer description: The duration in years. @@ -2231,18 +2248,22 @@ components: maximum: 25 example: 5 prolongable: + description: tells if a mortgage is prolongable or not. type: boolean + example: 0 propertyObjects: type: array + description: .. items: $ref: '#/components/schemas/PropertyObject' relatedMortgages: type: array + description: .. items: $ref: '#/components/schemas/Mortgage' Offer: - description: All relevant details describing the FI's offer for a mortgage product + description: All relevant details describing the FI's offer for a mortgage product. type: object required: - offerId @@ -2255,28 +2276,31 @@ components: type: string format: uuid example: 46eb482d-1e18-4b93-ae88-da14ad4ac051 - description: Uuid v4 of the specific order + description: Uuid v4 of the specific order. financingRequestId: type: string format: uuid example: fd3f2940-c9c9-46e7-8ed6-ab9e90363b2e - description: Uuid v4 of a specific financing request + description: Uuid v4 of a specific financing request. totalAmount: $ref: '#/components/schemas/Amount' validTo: $ref: '#/components/schemas/Date' offerItems: + description: .. type: array items: $ref: '#/components/schemas/OfferItem' offerType: type: string + description: type of offer (binding or indicative). + example: binding enum: - binding - indicative OfferItem: - description: All relevant details of a specific item being part of an FI's offer for a mortgage product + description: All relevant details of a specific item being part of an FI's offer for a mortgage product. type: object required: - offerItemId @@ -2286,22 +2310,23 @@ components: trancheId: type: string format: uuid - description: Uuid of the tranche + description: Uuid of the tranche. example: 51b017e1-5e59-4b58-a0a0-c638c87db463 offerItemId: type: string format: uuid example: d452083f-8316-410d-a609-d49463687329 - description: Uuid v4 of the specific offer item + description: Uuid v4 of the specific offer item. product: $ref: '#/components/schemas/Product' conditions: + description: .. type: array items: $ref: '#/components/schemas/Condition' ProductVariation: - description: Product variation details + description: Product variation details. type: object properties: duration: @@ -2328,7 +2353,7 @@ components: - 12m Product: - description: All details regarding an FI's mortgage product + description: All details regarding an FI's mortgage product. type: object required: - productId @@ -2342,12 +2367,13 @@ components: example: 20460121-6aff-485b-a61d-6056ecd72bd8 names: type: array + description: name of mortgage product. items: type: object properties: description: type: string - description: Product name description + description: Product name description. example: Fixed rate mortgage language: type: string @@ -2360,10 +2386,12 @@ components: - en productVariations: type: array + description: .. items: $ref: '#/components/schemas/ProductVariation' interestRateType: type: string + description: type of interest rate. example: libor enum: - variable @@ -2372,7 +2400,7 @@ components: - fixed Condition: - description: All details regarding the conditions for a specific mortgage product the FI offers + description: All details regarding the conditions for a specific mortgage product the FI offers. type: object required: - conditionId @@ -2384,11 +2412,13 @@ components: - amortization properties: conditionId: + description: ID of condition. type: string format: uuid example: ef737eb0-c0a7-4f44-bdeb-32ba9bd99327 productIdRef: type: string + description: Reference to product ID. format: uuid example: 0b34cd1b-32a5-4bb7-bcc5-bf81f8f8aaf1 duration: @@ -2404,12 +2434,14 @@ components: amountRange: $ref: '#/components/schemas/AmountRange' amortization: + description: the amount of repayment. type: integer + example: 1000 amortizations: $ref: '#/components/schemas/Amortizations' Party: - description: Links together the persons building the applicant party + description: Links together the persons building the applicant party. type: object required: - personList @@ -2426,12 +2458,13 @@ components: applicants and if known at the moment of the application. example: asd23f personList: + description: .. type: array items: $ref: '#/components/schemas/Applicant' Application: - description: All static application information needed by the FI to create binding offers + description: All static application information needed by the FI to create binding offers. type: object required: - mortgageType @@ -2445,7 +2478,7 @@ components: example: f157c4be-106d-4304-972e-091e77b87e1c tppApplicationId: type: string - description: The application alphanumeric identifier defined by TPP + description: The application alphanumeric identifier defined by TPP. pattern: '^[a-zA-Z0-9]{6,10}$' example: asd23f requestingParty: @@ -2465,7 +2498,7 @@ components: enum: - advisor - direct - description: The type of the channel the application was generated + description: The type of the channel the application was generated. example: advisor replacementType: type: string @@ -2476,47 +2509,49 @@ components: - entire - partial replacedTranches: + description: Tranche to be replaced. type: array items: type: object properties: replacedTrancheAmount: $ref: '#/components/schemas/Amount' - description: The amount of the replaced tranche + description: The amount of the replaced tranche. replacedTrancheExpiry: $ref: '#/components/schemas/Date' - description: The expiry date of the replaced tranche + description: The expiry date of the replaced tranche. example: 2022-05-03 replacedTrancheIssuer: type: string - description: The institute who has issued the replaced tranche + description: The institute who has issued the replaced tranche. example: Credit Suisse tppAdvisorDetail: + description: Personal information if the advisor of the TPP. type: object properties: name: type: string maxLength: 70 - description: Name of the TPP advisor + description: Name of the TPP advisor. example: Max surName: type: string maxLength: 70 - description: Surname of the TPP advisor + description: Surname of the TPP advisor. example: Muster nameTpp: type: string maxLength: 70 - description: Firm of the TPP advisor + description: Firm of the TPP advisor. example: Muster Finanz AG email: type: string - description: Email of the TPP advisor + description: Email of the TPP advisor. example: max.muster@domain.ch language: type: string example: fr - description: Preferred contact language of the TPP advisor + description: Preferred contact language of the TPP advisor. enum: - de - fr @@ -2524,19 +2559,19 @@ components: - en phone: type: string - description: phone of the TPP advisor + description: phone of the TPP advisor. example: '+41443343456' address: - $ref: '#/components/schemas/structuredAddress' + $ref: '#/components/schemas/StructuredAddress' Advertiser: - description: Information about the person or agency selling the property, in case it is applicable and known + description: Information about the person or agency selling the property, in case it is applicable and known. type: object required: - name properties: advertiserType: - description: Specifies if the advertiser is a private person, a company or an agency + description: Specifies if the advertiser is a private person, a company or an agency. type: string enum: - private @@ -2544,17 +2579,16 @@ components: - agency example: agency name: - description: The name of the advertiser - type: string + description: The name of the advertiser. maxLength: 140 example: Real Estate Agency AG contactPerson: - description: The person to contact in case the advertiser is an agency or a company + description: The person to contact in case the advertiser is an agency or a company. type: string maxLength: 140 example: Max Muster language: - description: Preferred contact language of the advertiser + description: Preferred contact language of the advertiser. type: string example: fr enum: @@ -2563,22 +2597,22 @@ components: - it - en phone: - description: The number on which the advertiser can be reached + description: The number on which the advertiser can be reached. type: string minLength: 4 maxLength: 13 - example: +41443343456 + example: '+41443343456' email: - description: The email address on which the advertiser can be contacted + description: The email address on which the advertiser can be contacted. type: string format: email minLength: 5 example: max.muster@domain.ch address: - $ref: '#/components/schemas/structuredAddress' + $ref: '#/components/schemas/StructuredAddress' MortgageCase: - description: A complete mortgage case including the application details + description: A complete mortgage case including the application details. type: object required: - caseId @@ -2589,7 +2623,7 @@ components: type: string format: uuid example: 2e1d21c3-0cd5-4354-a9e9-d2eb2c28b780 - description: Uuid v4 of the mortgage case + description: Uuid v4 of the mortgage case. application: $ref: '#/components/schemas/Application' financing: @@ -2597,10 +2631,10 @@ components: remark: type: string example: All documents verified at TPP - description: Remark/comment which can be added by TPP + description: Remark/comment which can be added by TPP. Financing: - description: Complete financing details of an application + description: Complete financing details of an application. type: object required: - amount @@ -2608,12 +2642,12 @@ components: financingId: type: string format: uuid - description: Uuid of the financing + description: Uuid of the financing. example: 6e61ff5d-3ffd-4254-a77d-73cc25d35e92 applicationIdRef: type: string format: uuid - description: Uuid of the financing's corresponding application + description: Uuid of the financing's corresponding application. example: 6e61ff5d-3ffd-4254-a77d-73cc25d35e92 amount: $ref: '#/components/schemas/Amount' @@ -2626,11 +2660,13 @@ components: amortizations: $ref: '#/components/schemas/Amortizations' tranches: + description: mortgage tranches. type: array items: $ref: '#/components/schemas/FinancingTranche' usedAssets: type: array + description: used assets. items: $ref: '#/components/schemas/UsedAsset' offerDate: @@ -2639,7 +2675,7 @@ components: $ref: '#/components/schemas/Date' FinancingTranche: - description: Tranche of a financing + description: Tranche of a financing. type: object required: - amount @@ -2650,7 +2686,7 @@ components: productIdRef: type: string format: uuid - description: Uuid of the product + description: Uuid of the product. example: 6e61ff5d-3ffd-4254-a77d-73cc25d35e92 amount: $ref: '#/components/schemas/Amount' @@ -2660,12 +2696,15 @@ components: $ref: '#/components/schemas/Date' duration: type: integer + description: duratin of the mortgage in years. + example: 2 minimum: 1 maximum: 20 interest: $ref: '#/components/schemas/Interest' interestRateType: type: string + description: type of interest rate. example: libor enum: - variable @@ -2685,7 +2724,7 @@ components: $ref: '#/components/schemas/Amortizations' FinancingRequest: - description: Based on the application, several financing requests can be sent to the FI + description: Based on the application, several financing requests can be sent to the FI. type: object required: - applicationId @@ -2695,12 +2734,12 @@ components: type: string format: uuid example: 2e1d21c3-0cd5-4354-a9e9-d2eb2c28b780 - description: Uuid v4 of the financing request defined by FI + description: Uuid v4 of the financing request defined by FI. applicationId: type: string format: uuid example: 3c921870-f29c-46ad-9ba5-c8b05e0d88d2 - description: Uuid v4 of the corresponding application + description: Uuid v4 of the corresponding application. amount: $ref: '#/components/schemas/Amount' increaseAmount: @@ -2710,6 +2749,7 @@ components: description: The purpose of the increase. example: renovation of the kitchen tranches: + description: a mortgage amount is distributed in one or more tranches. type: array items: type: object @@ -2722,7 +2762,7 @@ components: productId: type: string format: uuid - description: Uuid of the product + description: Uuid of the product. example: 6e61ff5d-3ffd-4254-a77d-73cc25d35e92 productVariation: $ref: '#/components/schemas/ProductVariation' @@ -2731,13 +2771,16 @@ components: amount: $ref: '#/components/schemas/Amount' usedAssets: + description: Assets being used for the financing request. type: array items: $ref: '#/components/schemas/UsedAsset' publicCertDate: $ref: '#/components/schemas/Date' requestOfferType: + description: Ding dong die Hex ist tot. type: string + example: binding enum: - binding - indicative @@ -2753,7 +2796,7 @@ components: applicantId: type: string format: uuid - description: UUID v4 of the applicant (to be defined by TPP) + description: UUID v4 of the applicant (to be defined by TPP). example: 576f8de3-6b30-4882-a7af-da2132a456cf fiApplicantId: type: string @@ -2762,18 +2805,20 @@ components: only applicable if known at the moment of the application. example: asd23f applicantType: + description: type of applicant. type: string example: individual enum: - individual - legal_entity applicantDetail: + description: personal information regarding the applicant. type: object properties: name: type: string maxLength: 70 - description: Name of the applicant + description: Name of the applicant. example: Max surName: type: string @@ -2781,13 +2826,13 @@ components: description: Surname of the applicant example: Muster address: - $ref: '#/components/schemas/structuredAddress' + $ref: '#/components/schemas/StructuredAddress' birthDate: $ref: '#/components/schemas/Date' maritalStatus: type: string example: married - description: Martial status of the applicant + description: Martial status of the applicant. enum: - unmarried - married @@ -2807,7 +2852,7 @@ components: jobSituation: type: string example: employed - description: Job situation of the applicant + description: Job situation of the applicant. enum: - employed - selfEmployed @@ -2817,15 +2862,15 @@ components: $ref: '#/components/schemas/Country' USPerson: type: boolean - description: Is the applicant a US person? + description: Is the applicant a US person. example: false email: type: string - description: Email of the applicant + description: Email of the applicant. example: max.muster@domain.ch phone: type: string - description: Phone number of the applicant + description: Phone number of the applicant. example: '+41443343456' solvencyRating: description: Solvency rating of the applicant e.g. CRIF @@ -2840,17 +2885,17 @@ components: example: 420 ratingSourceType: type: string - description: Provider of the solvency rating + description: Provider of the solvency rating. example: crif enum: - crif ratingDate: $ref: '#/components/schemas/Date' - description: Date of the solvency rating + description: Date of the solvency rating. applicantLanguage: type: string example: fr - description: Preferred contact language of the applicant + description: Preferred contact language of the applicant. enum: - de - fr @@ -2866,6 +2911,7 @@ components: description: Gender of the applicant. financialSituation: type: object + description: the overall financial situation of a debtor. properties: income: type: array @@ -2881,6 +2927,7 @@ components: $ref: '#/components/schemas/Amount' remark: type: string + example: We need an example for such a remark incomeProvider: description: Income provider for each income or cost position can be transferred. type: string @@ -2906,6 +2953,7 @@ components: $ref: '#/components/schemas/Amount' remark: type: string + example: We need an example for such a remark liabilityProvider: description: Name of the liability provider or creditor. type: string @@ -2931,17 +2979,17 @@ components: nameAdditionalProperty: type: string maxLength: 70 - description: Name of the additional property + description: Name of the additional property. example: Orchard Villa, Holderstrasse 10 valueAdditionalProperty: $ref: '#/components/schemas/Amount' - description: Value of the additional property + description: Value of the additional property. propertyTypeAdditionalProperty: type: string enum: - single_family_house - condominium - - vacation_house, + - vacation_house - vacation_condominium - agricultural_farm - 2or3_family_house @@ -2953,7 +3001,7 @@ components: - office_building - industrial_building - special_object - description: The type of the additional property + description: The type of the additional property. example: vacation_house # ---- Mortgage data types ---- @@ -3025,9 +3073,11 @@ components: surrender value in life insurance insuranceSum: $ref: '#/components/schemas/Amount' - description: The amount of the sum insured in life insurance + description: The amount of the sum insured in life insurance. remark: type: string + description: remark remark. + example: We need an example for such a remark assetProvider: $ref: '#/components/schemas/AssetProvider' @@ -3047,13 +3097,13 @@ components: $ref: '#/components/schemas/Amount' insuranceSum: $ref: '#/components/schemas/Amount' - description: The amount of the sum insured in life insurance + description: The amount of the sum insured in life insurance. usageType: $ref: '#/components/schemas/AssetUsageType' applicantId: type: string format: uuid - description: UUID v4 of the applicant (existing applicant within the current application) + description: UUID v4 of the applicant (existing applicant within the current application). example: 576f8de3-6b30-4882-a7af-da2132a456cf assetProvider: $ref: '#/components/schemas/AssetProvider' @@ -3154,26 +3204,29 @@ components: type: string format: uuid example: 6faea0b8-26a2-4b17-b10f-8f56fe355f50 - description: Uuid v4 of the order defined by FI + description: Uuid v4 of the order defined by FI. offerId: type: string format: uuid + description: uuid of offer. example: 2752ce81-5bf0-4991-89ac-87d6e7fd0c47 mortgageId: type: string format: uuid + description: uuid of mortgage. example: ef25ce8b-2fb1-45d9-bae0-6f263241a280 applicationId: type: string format: uuid + description: ID of application. example: 59e8c8a6-4d32-4e7b-bcf0-05813029498e remark: type: string example: All documents verified at TPP - description: Remark/comment which can be added by TPP + description: Remark/comment which can be added by TPP. Document: - description: Document containing information for givent document type for given order. + description: Document containing information for given document type for given order. type: object required: - name @@ -3181,19 +3234,19 @@ components: name: type: string example: MortgageOffer_WaimerANON_587b23d1-12a8-475a-968b-abee245e3393 - description: Name of the document + description: Name of the document. parentId: type: string format: uuid example: 2752ce81-5bf0-4991-89ac-87d6e7fd0c47 - description: Id for parent object of given document + description: Id for parent object of given document. content: type: string - description: base64 Encoded Content + description: base64 Encoded Content. example: JVBERi0xLjQKJeLjz9MKMzEgMCBvYmoKPDwvQnl0ZVJhbmdl contentType: type: string - description: Content type + description: Content type. example: application/octet-stream createDate: $ref: '#/components/schemas/Date' @@ -3209,11 +3262,11 @@ components: enum: - direct - indirect - description: The type of amortization + description: The type of amortization. example: direct amortizationAmount: $ref: '#/components/schemas/Amount' - description: The amount of the periodic amortization + description: The amount of the periodic amortization. example: 27400 amortizationStart: $ref: '#/components/schemas/Date' @@ -3225,16 +3278,16 @@ components: - yearly - quarterly - monthly - description: The periodicity the amortization is paid + description: The periodicity the amortization is paid. example: quarterly amortizationAccountNr: type: string - description: The account number from which the amortization is paid + description: The account number from which the amortization is paid. example: IE12BOFI90000112345678 AssetProvider: description: > - Asset provider for each asset, additional information must be transfered. E.g. in case the applicant owns an addtional security of type + Asset provider for each asset, additional information must be transferred. E.g. in case the applicant owns an additional security of type insurance, insurance company name is provided type: object required: @@ -3243,10 +3296,10 @@ components: name: type: string example: Credit Suisse - description: Name of the asset provider + description: Name of the asset provider. AmountRange: - description: Min and max amount with currency + description: Min and max amount with currency. type: object required: - currency @@ -3256,18 +3309,18 @@ components: currency: $ref: '#/components/schemas/Currency' minContent: - description: min amount given with fractional digits, the separator is a dot + description: min amount given with fractional digits, the separator is a dot. type: string pattern: '^-?\d{1,14}(?:\.\d{1,3})?$' - example: 1000000 + example: '1000000' maxContent: - description: max amount given with fractional digits, the separator is a dot + description: max amount given with fractional digits, the separator is a dot. type: string pattern: '^-?\d{1,14}(?:\.\d{1,3})?$' - example: 5000000 + example: '5000000' Interest: - description: The current rate and optionally the referred base + description: The current rate and optionally the referred base. type: object required: - currentRate @@ -3276,7 +3329,7 @@ components: type: number format: double description: > - Interest reate in decimals. 2.45% would be sent as 0.0245. For flexible interest mortgage this would show + Interest rate in decimals. 2.45% would be sent as 0.0245. For flexible interest mortgage this would show the margin above interest. minimum: 0 maximum: 1 @@ -3284,184 +3337,158 @@ components: base: type: number format: double - description: Base rate uupon margin is applied (e.g. for SARON). + description: Base rate upon margin is applied (e.g. for SARON). minimum: 0 maximum: 1 example: 0.5 Link: - description: Object containing a link to an external resource and its description + description: Object containing a link to an external resource and its description. type: object required: - url properties: url: - description: The URL pointing to the resource + description: The URL pointing to the resource. type: string format: uri minLength: 2 example: http://www.example.com/property.png name: - description: The name of the resource + description: The name of the resource. type: string example: Property image description: - description: A description of the resource + description: A description of the resource. type: string example: The image shows the aerial view of the property # ---- Global Common Header Parameters ---- parameters: path_caseId: - name: caseId in: path - description: Uuid v4 of a specific existing mortgage case + name: caseId required: true schema: type: string format: uuid - example: bcb5d762-8d28-43a2-9398-393b2e8d56ba + example: bcb5d762-8d28-43a2-9398-393b2e8d56ba$ + description: Uuid v4 of a specific existing mortgage case. path_mortgageId: - name: mortgageId in: path - description: Uuid v4 of a specific existing mortgage + name: mortgageId required: true schema: type: string format: uuid example: bcb5d762-8d28-43a2-9398-393b2e8d56ba + description: Uuid v4 of a specific existing mortgage. path_productId: - name: productId in: path - description: A product's uuid v4 + name: productId required: true schema: type: string format: uuid example: a86dd383-055e-471a-a098-682ae5ef8348 + description: A product's uuid v4. path_applicationId: - name: applicationId in: path - description: Uuid v4 of the application request + name: applicationId required: true schema: type: string format: uuid example: 4bf92636-14a0-4511-98e2-acfde576e644 + description: Uuid v4 of the application request. path_documentId: - name: documentId in: path - description: Unique ID (uuid v4) of the document + name: documentId required: true schema: type: string format: uuid example: 7f648f12-c15f-4930-8380-238da5671c37 + description: Unique ID (uuid v4) of the document. path_financingRequestId: - name: financingRequestId in: path - description: Uuid v4 of the financing request + name: financingRequestId required: true schema: type: string format: uuid example: 1a75e7fc-f3c3-45a9-9268-ec21c405bbc8 + description: Uuid v4 of the financing request. path_offerId: - name: offerId in: path - description: Uuid v4 of the offer + name: offerId required: true schema: type: string format: uuid example: c2fee261-053c-4088-8986-11216f0c9be6 + description: Uuid v4 of the offer. path_orderId: - name: orderId in: path - description: Uuid v4 of an order + name: orderId required: true schema: type: string format: uuid example: 91d029b3-ee7a-44c3-ac18-cf621cb128a8 - - clientid_in_header: - name: X-CorAPI-Client-ID - in: header - schema: - type: string - description: > - ID of the client forwarded to the provider. (SCOPE: FI) - required: true - - correlation_in_header: - name: X-Correlation-ID - in: header - schema: - type: string - description: Unique ID (defined by the caller) which will be reflected back in the response. - required: true - - agent_in_header: - name: User-Agent - in: header - schema: - type: string - description: Name and version of the of the Client software - required: true + description: Uuid v4 of an order. offset: - name: offset in: query - description: Optional parameter for pagination. The number of items to skip before starting to collect the result set. + name: offset required: false schema: type: integer format: int32 example: 25 minimum: 0 + description: Optional parameter for pagination. The number of items to skip before starting to collect the result set. limit: - name: limit in: query - description: Optional parameter for pagination. Maximum number of entries to be returned. + name: limit required: false schema: type: integer format: int32 example: 25 minimum: 1 + description: Optional parameter for pagination. Maximum number of entries to be returned. cursor: - name: cursor in: query - description: Optional parameter for pagination. An opaque string value used for pagination. + name: cursor required: false schema: type: string example: cursorIDxyz + description: Optional parameter for pagination. An opaque string value used for pagination. duration: - name: duration in: query - description: The type of duration (for filtering) + name: duration schema: type: integer minimum: 1 maximum: 20 example: 10 + description: The type of duration (for filtering). language: - name: language in: query - description: Language of Document content + name: language required: true schema: type: string @@ -3471,29 +3498,47 @@ components: - it - en example: fr + description: Language of Document content. - # --- Response Headers - used by Standard Responses --- - headers: - Content-Language: - description: Response language - always en + clientid_in_header: + in: header + name: X-CorAPI-Client-ID + required: true schema: type: string + description: ID of the client forwarded to the provider. - Content-Type: - description: application/problem+json; charset=utf-8 according to RFC7807 + correlation_in_header: + in: header + name: X-Correlation-ID + required: true schema: type: string + description: Unique ID (defined by the caller) which will be reflected back in the response. - Location: - description: Location (submissionId) of the submitted message. Add /status for the status report. + agent_in_header: + in: header + name: User-Agent + required: true schema: type: string + description: Name and version of the of the Client software. - X-Correlation-ID: - description: Client defined ID from request to correlates HTTP requests between a client and server - schema: - type: string - example: f058ebd6-02f7-4d3f-942e-904344e8cde5 + securitySchemes: + ApiKeyAuth: + type: apiKey + in: header + name: X-API-Key + + OAuth2: + type: oauth2 + flows: + authorizationCode: + authorizationUrl: https://example.com/oauth/authorize + tokenUrl: https://example.com/oauth/token + scopes: + read: Grants read access + write: Grants write access responses: standard201: @@ -3501,7 +3546,7 @@ components: content: application/json: schema: - $ref: '#/components/schemas/commonResourceCreatedResponse' + $ref: '#/components/schemas/CommonResourceCreatedResponse' headers: location: schema: @@ -3529,7 +3574,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard401: headers: @@ -3543,7 +3588,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard403: headers: @@ -3557,7 +3602,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard404: headers: @@ -3573,7 +3618,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard405: headers: @@ -3589,7 +3634,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard500: headers: @@ -3603,7 +3648,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard501: headers: @@ -3617,7 +3662,7 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' standard503: headers: @@ -3631,4 +3676,28 @@ components: content: application/problem+json: schema: - $ref: '#/components/schemas/commonErrorResponse' + $ref: '#/components/schemas/CommonErrorResponse' + # ---- End Responses - Standard + + # --- Response Headers - used by Standard Responses --- + headers: + Content-Language: + description: Response language - always en + schema: + type: string + + Content-Type: + description: application/problem+json; charset=utf-8 according to RFC7807 + schema: + type: string + + Location: + description: Location (submissionId) of the submitted message. Add /status for the status report. + schema: + type: string + + X-Correlation-ID: + description: Client defined ID from request to correlates HTTP requests between a client and server + schema: + type: string + example: f058ebd6-02f7-4d3f-942e-904344e8cde5 From abfb194fea663ef4b16ccc5fa4f6607610814a88 Mon Sep 17 00:00:00 2001 From: celinevananraad <121175253+celinevananraad@users.noreply.github.com> Date: Thu, 31 Oct 2024 13:53:27 +0100 Subject: [PATCH 25/25] Linking additional properties to the respective mortgage (#177) Added an additional field to additionalProperties --- mortgageAPI.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mortgageAPI.yaml b/mortgageAPI.yaml index 7a05714..e59b062 100644 --- a/mortgageAPI.yaml +++ b/mortgageAPI.yaml @@ -2984,6 +2984,8 @@ components: valueAdditionalProperty: $ref: '#/components/schemas/Amount' description: Value of the additional property. + mortgageAmountAdditionalProperty: + $ref: '#/components/schemas/Amount' propertyTypeAdditionalProperty: type: string enum: