A .NET 7 based Azure Function implementation of the SmartBearCoin Payee API.
Here we implement the API (as per design) by manually creating an Azure Function using .NET 6.0. To speed up the creation and to ensure we conform with the schemas, we'll use SwaggerHub code generation capabilities.
- In SwaggerHub export a server stub from the OpenAPI definition (Export > Server Stub > aspnetcore)
- Extract the models into the Models > OpenAPI folder of the
provider_azure_functionsolution - Ensure all paths defined in the OpenAPI definition are implemented by an Azure Function controller
- Build out the appropriate validation services as required
- Ensure all required infrastructure is contained in the Azure Resource Manager template (
azuredeploy.json) - Build and commit the project
- Kick off the
Provider-API-AzureFunction-CIGitHub action which covers the following:- checks out and builds
- tests using ReadyAPI project created above
- deploys infra to azure
- adds provider contract to PactFlow leveraging the
can-i-deploycheck
If you want to run and edit the provider locally, then take note of the following:
- VSCode, Visual Studio or other IDE capable of running .NET 7 projects
- .NET 7
- Azure Functions Core Tools (>= v4.0.5571)
- ngrok
The project was created using VSCode with the following extensions installed:
Ensure that your development certs are trusted (required for debugging)
dotnet dev-certs https --trust
Clone the repo and ensure the project builds
dotnet build
Setup your local.settings.json file. Here is a sample settings configuration:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
},
"Host": {
"CORS": "*"
}
}

