-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dan/per-11119-add-rebac-native-support-for-dotnet-sdk (#31)
* Changed .net to 9 * Changed test token to env variable * Changed OpenAPI generation flow * Added workflow to generate OpenAPI specs * Added tests on PR * Added skip commit when no changes * Fixed tests * Added kwarg based bypass to OpenAPI calls * Added relationship tuple APIs * Changed SyncUser to use Replace_userAsync (aka PUT method) * Added docs to APIs * Changed test sleep to 10 sec * Fixed PDP run command * Fixed PDP run command
- Loading branch information
Showing
23 changed files
with
65,484 additions
and
5,695 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"csharpier": { | ||
"version": "0.30.3", | ||
"commands": [ | ||
"dotnet-csharpier" | ||
], | ||
"rollForward": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Generate SDK and Open PR | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 12 * * 0' # Runs every Sunday at 12:00 UTC | ||
|
||
|
||
jobs: | ||
generate-sdk: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Run SDK generation script | ||
run: generate_openapi.sh | ||
|
||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git diff --exit-code || echo "changes" | ||
- name: Commit changes | ||
if: steps.check_changes.outputs.changes == 'changes' | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git checkout -b feat/sdk-update-$(date +'%Y%m%d') | ||
git add . | ||
git commit -m "Update SDK from OpenAPI specs" | ||
- name: Push changes to a new branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git push origin feat/sdk-update-$(date +'%Y%m%d') | ||
- name: Create a pull request | ||
id: create_pr | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: sdk-update-$(date +'%Y%m%d') | ||
title: "OpenAPI SDK Update" | ||
body: "This PR updates the SDK based on the latest OpenAPI specifications." | ||
|
||
- name: Output PR URL | ||
if: steps.create_pr.outputs.pull-request-url != '' | ||
run: | | ||
echo "Pull Request URL: ${{ steps.create_pr.outputs.pull-request-url }}" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test-dotnet-sdk: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
services: | ||
pdp: | ||
image: permitio/pdp-v2:latest | ||
ports: | ||
- 7766:7000 | ||
env: | ||
PDP_API_KEY: ${{ secrets.PERMIT_API_KEY }} | ||
PDP_DEBUG: true | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup .NET Core SDK | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: | | ||
9.0.x | ||
- name: Restore dependencies | ||
working-directory: ./src/permit | ||
run: dotnet restore | ||
|
||
|
||
- name: Run Tests | ||
working-directory: ./tests/PermitTests | ||
env: | ||
PERMIT_API_KEY: ${{ secrets.PERMIT_API_KEY }} | ||
run: dotnet test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
echo "Downloading OpenAPI schema files" | ||
curl https://api.permit.io/v2/openapi.json -o openapi.json | ||
curl https://pdp-api.permit.io/openapi.json -o pdp-openapi.json | ||
|
||
echo "Transforming OpenAPI union types to simple types" | ||
python transform_openapi.py openapi.json openapi.json | ||
python transform_openapi.py pdp-openapi.json pdp-openapi.json | ||
|
||
echo "Generating OpenAPI client" | ||
npm run update-api | ||
npm run update-pdp-api | ||
|
||
echo "Fixing status code checks" | ||
sed -i '' -f update_status_check.sed ./src/permit/PermitOpenAPI.cs | ||
sed -i '' -f update_status_check.sed ./src/permit/PermitPDPOpenAPI.cs | ||
|
||
echo "Done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.