From 47f9be9f67fa29dcdd3f4a8db4c4358c8d7d392b Mon Sep 17 00:00:00 2001 From: Rafal Mielowski Date: Thu, 7 May 2026 16:47:45 +0200 Subject: [PATCH] chore: renormalize line endings to match .gitattributes Stored blobs for several text files were committed with LF endings (via upstream Dependabot PRs #247, #233, #198 and earlier commits) after .gitattributes declared *.csproj text eol=crlf (commit e0897bd) and * text=auto for the rest. On Windows checkouts the smudge filter rewrote them to the platform EOL, producing a permanent `modified` working-tree state for these files. Run git add --renormalize . to re-stage them with the declared EOL so the working tree stays clean for new contributors. Affected files (EOL-only diff, no content change): - .github/workflows/dotnet.yml - .vscode/extensions.json - README.md - example/.config/dotnet-tools.json - setup-example.cmd - src/Compiling/Compiling.csproj - src/Testing/Testing.csproj Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .github/workflows/dotnet.yml | 180 +++++++++++++++--------------- .vscode/extensions.json | 18 +-- README.md | 48 ++++---- example/.config/dotnet-tools.json | 22 ++-- setup-example.cmd | 8 +- src/Compiling/Compiling.csproj | 98 ++++++++-------- src/Testing/Testing.csproj | 98 ++++++++-------- 7 files changed, 236 insertions(+), 236 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index e1a4b20f..4dbd526b 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,90 +1,90 @@ -name: CI - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -permissions: - contents: read - -jobs: - build-and-test: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.x - - name: Restore dependencies - run: dotnet restore - - name: Build with dotnet - run: dotnet build --no-restore - - name: Test with dotnet - run: dotnet test --no-build --logger trx --results-directory "TestResults" - - name: Upload dotnet test results - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: dotnet-test-results-${{ matrix.os }} - path: TestResults - - name: Check format - if: ${{ always() }} - run: dotnet format style --verify-no-changes --report "FormatReport" - - name: Upload format report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: dotnet-format-report-${{ matrix.os }} - path: FormatReport - - example-project: - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, macos-latest, windows-latest] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 8.0.x - - name: Create new packages - run: dotnet pack - - name: Rename example project - working-directory: ./example - run: mv Example.sln.example Example.sln - - name: Rename source.example project - working-directory: ./example/source - run: mv Source.Example.csproj.example Source.Example.csproj - - name: Rename test.example project - working-directory: ./example/test - run: mv Test.Example.csproj.example Test.Example.csproj - - name: Restore dependencies - working-directory: ./example - run: dotnet restore - - name: Restore tool - working-directory: ./example - run: dotnet tool restore - - name: Build with dotnet - working-directory: ./example - run: dotnet build --no-restore - - name: Test with dotnet - working-directory: ./example - run: dotnet test --no-build --logger trx --results-directory "TestResults" - - name: Upload dotnet test results - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: dotnet-test-results-example-${{ matrix.os }} - path: ./example/TestResults - - name: Compile policies - working-directory: ./example - run: dotnet azure-apim-policy-compiler --s ./source/ --o ./target/ --format true +name: CI + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build-and-test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build with dotnet + run: dotnet build --no-restore + - name: Test with dotnet + run: dotnet test --no-build --logger trx --results-directory "TestResults" + - name: Upload dotnet test results + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: dotnet-test-results-${{ matrix.os }} + path: TestResults + - name: Check format + if: ${{ always() }} + run: dotnet format style --verify-no-changes --report "FormatReport" + - name: Upload format report + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: dotnet-format-report-${{ matrix.os }} + path: FormatReport + + example-project: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + - name: Create new packages + run: dotnet pack + - name: Rename example project + working-directory: ./example + run: mv Example.sln.example Example.sln + - name: Rename source.example project + working-directory: ./example/source + run: mv Source.Example.csproj.example Source.Example.csproj + - name: Rename test.example project + working-directory: ./example/test + run: mv Test.Example.csproj.example Test.Example.csproj + - name: Restore dependencies + working-directory: ./example + run: dotnet restore + - name: Restore tool + working-directory: ./example + run: dotnet tool restore + - name: Build with dotnet + working-directory: ./example + run: dotnet build --no-restore + - name: Test with dotnet + working-directory: ./example + run: dotnet test --no-build --logger trx --results-directory "TestResults" + - name: Upload dotnet test results + if: ${{ always() }} + uses: actions/upload-artifact@v4 + with: + name: dotnet-test-results-example-${{ matrix.os }} + path: ./example/TestResults + - name: Compile policies + working-directory: ./example + run: dotnet azure-apim-policy-compiler --s ./source/ --o ./target/ --format true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e3746e3b..439bb090 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,10 +1,10 @@ -{ - "recommendations": [ - "ms-dotnettools.vscode-dotnet-runtime", - "ms-dotnettools.csharp", - "ms-dotnettools.csdevkit", - "ms-dotnettools.vscodeintellicode-csharp", - "editorconfig.editorconfig", - "streetsidesoftware.code-spell-checker" - ] +{ + "recommendations": [ + "ms-dotnettools.vscode-dotnet-runtime", + "ms-dotnettools.csharp", + "ms-dotnettools.csdevkit", + "ms-dotnettools.vscodeintellicode-csharp", + "editorconfig.editorconfig", + "streetsidesoftware.code-spell-checker" + ] } \ No newline at end of file diff --git a/README.md b/README.md index 6d642519..da2b6d0e 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,24 @@ -# Azure API Management policy toolkit - -**Azure API management policy toolkit** is a set of libraries and tools for authoring [**policy documents**](https://learn.microsoft.com/azure/api-management/api-management-howto-policies) for [**Azure API Management**](https://learn.microsoft.com/azure/api-management/). The toolkit was designed to help **create** and **test** policy documents with complex expressions. - -Before the Policy toolkit, policy documents were written in Razor format, which is hard to read and understand, especially when there are multiple expressions. The feedback loop on new documents or even the smallest changes was very long, requiring a live Azure API Management instance, a policy document deployment, and manual testing through the API request. - -The policy toolkit changes that. It allows you to write policy documents in C# language, which is more natural and doesn't require you to jump between C# and XML for expression creation. Creating policy documents in C# also brings the advantage of using simple C# code for unit testing of policy documents. - -The toolkit also includes a **decompiler** that converts existing APIM policy XML documents into C# code, enabling round-trip workflows: decompile existing policies to C#, edit them, then compile back to XML. See the [available policies](docs/AvailablePolicies.md) for supported policies and the `src/Decompiling/` CLI tool for batch decompilation. - -## Documentation - -:exclamation: Packages are only avaliable for download from github release. We are working to bring them to public nuget. - -#### Azure API Management policy toolkit documentation for users. -* [Quick start](docs/QuickStart.md) -* [Available policies](docs/AvailablePolicies.md) -* [Solution structure recommendation](docs/SolutionStructureRecommendation.md) -* [Steps for deploying policies created by the policy toolkit](docs/IntegratePolicySolution.md) -* [Integrate policy solution with APIOps](docs/IntegratePolicySolutionWithApiOps.md) - -#### Azure API Management policy toolkit documentation for contributors. -* [Contributor guide](CONTRIBUTING.md) -* [Development environment setup](docs/DevEnvironmentSetup.md) +# Azure API Management policy toolkit + +**Azure API management policy toolkit** is a set of libraries and tools for authoring [**policy documents**](https://learn.microsoft.com/azure/api-management/api-management-howto-policies) for [**Azure API Management**](https://learn.microsoft.com/azure/api-management/). The toolkit was designed to help **create** and **test** policy documents with complex expressions. + +Before the Policy toolkit, policy documents were written in Razor format, which is hard to read and understand, especially when there are multiple expressions. The feedback loop on new documents or even the smallest changes was very long, requiring a live Azure API Management instance, a policy document deployment, and manual testing through the API request. + +The policy toolkit changes that. It allows you to write policy documents in C# language, which is more natural and doesn't require you to jump between C# and XML for expression creation. Creating policy documents in C# also brings the advantage of using simple C# code for unit testing of policy documents. + +The toolkit also includes a **decompiler** that converts existing APIM policy XML documents into C# code, enabling round-trip workflows: decompile existing policies to C#, edit them, then compile back to XML. See the [available policies](docs/AvailablePolicies.md) for supported policies and the `src/Decompiling/` CLI tool for batch decompilation. + +## Documentation + +:exclamation: Packages are only avaliable for download from github release. We are working to bring them to public nuget. + +#### Azure API Management policy toolkit documentation for users. +* [Quick start](docs/QuickStart.md) +* [Available policies](docs/AvailablePolicies.md) +* [Solution structure recommendation](docs/SolutionStructureRecommendation.md) +* [Steps for deploying policies created by the policy toolkit](docs/IntegratePolicySolution.md) +* [Integrate policy solution with APIOps](docs/IntegratePolicySolutionWithApiOps.md) + +#### Azure API Management policy toolkit documentation for contributors. +* [Contributor guide](CONTRIBUTING.md) +* [Development environment setup](docs/DevEnvironmentSetup.md) diff --git a/example/.config/dotnet-tools.json b/example/.config/dotnet-tools.json index 7f71f75a..65380b97 100644 --- a/example/.config/dotnet-tools.json +++ b/example/.config/dotnet-tools.json @@ -1,12 +1,12 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling": { - "version": "1.0.0", - "commands": [ - "azure-apim-policy-compiler" - ] - } - } +{ + "version": 1, + "isRoot": true, + "tools": { + "Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling": { + "version": "1.0.0", + "commands": [ + "azure-apim-policy-compiler" + ] + } + } } \ No newline at end of file diff --git a/setup-example.cmd b/setup-example.cmd index a9db6008..fd70bbcb 100644 --- a/setup-example.cmd +++ b/setup-example.cmd @@ -1,4 +1,4 @@ -dotnet build -dotnet pack -cd ./example -dotnet tool restore +dotnet build +dotnet pack +cd ./example +dotnet tool restore diff --git a/src/Compiling/Compiling.csproj b/src/Compiling/Compiling.csproj index 08d21030..f39e6e3c 100644 --- a/src/Compiling/Compiling.csproj +++ b/src/Compiling/Compiling.csproj @@ -1,49 +1,49 @@ - - - - 1.0.0 - Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling - Microsoft - Microsoft Corporation - © Microsoft Corporation. All rights reserved. - Azure API Management Policy Toolkit - pkgicon.png - MIT - true - https://github.com/Azure/azure-api-management-policy-toolkit - $(RepositoryUrl) - - Azure API Management Policy Toolkit Compiling is a dotnet tool allowing you to transform policy document(s) from C# code to XML. - Read more about it at https://github.com/Azure/azure-api-management-policy-toolkit - - Azure;Azure API Management;API Gateway;API Management;Policy;Policies;Policy Toolkit;Compiling;Policy Toolkit Compiling - en-US - README.md - - - - Exe - .net8 - enable - enable - Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling - - false - true - azure-apim-policy-compiler - ..\..\output - - - - - - - - - - - - - - - + + + + 1.0.0 + Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling + Microsoft + Microsoft Corporation + © Microsoft Corporation. All rights reserved. + Azure API Management Policy Toolkit + pkgicon.png + MIT + true + https://github.com/Azure/azure-api-management-policy-toolkit + $(RepositoryUrl) + + Azure API Management Policy Toolkit Compiling is a dotnet tool allowing you to transform policy document(s) from C# code to XML. + Read more about it at https://github.com/Azure/azure-api-management-policy-toolkit + + Azure;Azure API Management;API Gateway;API Management;Policy;Policies;Policy Toolkit;Compiling;Policy Toolkit Compiling + en-US + README.md + + + + Exe + .net8 + enable + enable + Microsoft.Azure.ApiManagement.PolicyToolkit.Compiling + + false + true + azure-apim-policy-compiler + ..\..\output + + + + + + + + + + + + + + + diff --git a/src/Testing/Testing.csproj b/src/Testing/Testing.csproj index 046c1759..7c5354fb 100644 --- a/src/Testing/Testing.csproj +++ b/src/Testing/Testing.csproj @@ -1,50 +1,50 @@ - - - - 1.0.0 - Microsoft.Azure.ApiManagement.PolicyToolkit.Testing - Microsoft - Microsoft Corporation - © Microsoft Corporation. All rights reserved. - Azure API Management Policy Toolkit - pkgicon.png - MIT - true - https://github.com/Azure/azure-api-management-policy-toolkit - $(RepositoryUrl) - - Azure API Management Policy Toolkit Testing is a library which helps in testing expressions and policy documents created in code. - Read more about it at https://github.com/Azure/azure-api-management-policy-toolkit - - Azure;Azure API Management;API Gateway;API Management;Policy;Policies;Policy Toolkit;Policy Testing;Policy Expression Testing - en-US - README.md - - - - .net8 - enable - enable - true - ..\..\output - true - false - false - Microsoft.Azure.ApiManagement.PolicyToolkit.Testing - - - - - - - - - - - - - - - - + + + + 1.0.0 + Microsoft.Azure.ApiManagement.PolicyToolkit.Testing + Microsoft + Microsoft Corporation + © Microsoft Corporation. All rights reserved. + Azure API Management Policy Toolkit + pkgicon.png + MIT + true + https://github.com/Azure/azure-api-management-policy-toolkit + $(RepositoryUrl) + + Azure API Management Policy Toolkit Testing is a library which helps in testing expressions and policy documents created in code. + Read more about it at https://github.com/Azure/azure-api-management-policy-toolkit + + Azure;Azure API Management;API Gateway;API Management;Policy;Policies;Policy Toolkit;Policy Testing;Policy Expression Testing + en-US + README.md + + + + .net8 + enable + enable + true + ..\..\output + true + false + false + Microsoft.Azure.ApiManagement.PolicyToolkit.Testing + + + + + + + + + + + + + + + + \ No newline at end of file