Skip to content

Commit

Permalink
CR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathieu Gamache committed Dec 20, 2023
1 parent 12a5101 commit f8fd084
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ Validates at build time that the OpenAPI specification files extracted from the

Depending if the user chose the Contract-First or Code-First development mode this MSBuild task will:

- Install tools: OasDiff, Spectral, SwashbuckleCLI
- Install tools: [OasDiff](https://github.com/Tufin/oasdiff), [Spectral](https://github.com/stoplightio/spectral), [SwashbuckleCLI](https://github.com/domaindrivendev/Swashbuckle.AspNetCore?tab=readme-ov-file#swashbuckleaspnetcorecli)
- Generate the OpenAPI specification file from the associated Web API
- Validate Spectral rules
- Validate [Workleap Spectral rules](https://github.com/gsoft-inc/wl-api-guidelines/blob/main/.spectral.yaml)
- Compare the given OpenAPI specification file with the generated one

## How it works

[Official Documentation](https://learn.microsoft.com/en-us/visualstudio/msbuild/tutorial-custom-task-code-generation?view=vs-2022#include-msbuild-properties-and-targets-in-a-package)

For the TLDR version:

- The entry point is `ValidateOpenApiTask.ExecuteAsync()` and will be executed after the referencing project is built. This is defined in `./src/Workleap.OpenApi.MSBuild/msbuild/tools/Workleap.OpenApi.MSBuild.targets` as a `UsingTask.TaskName`
- The default value are defined in the property group on the target `ValidateOpenApi` in this file `./src/Workleap.OpenApi.MSBuild/msbuild/tools/Workleap.OpenApi.MSBuild.targets`

Expand Down
2 changes: 1 addition & 1 deletion src/Workleap.OpenApi.MSBuild/ContractFirstProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// <summary>
/// For a Contract First approach it will:
/// 1. Validate the OpenAPI specification files base on spectral rules
/// 2. If validateCodeSync=true, will generate the OpenAPI specification files from the code and validate if it match the provided specifications.
/// 2. If <see cref="CompareCodeAgainstSpecFile"/> is enabled, will generate the OpenAPI specification files from the code and validate if it match the provided specifications.
/// </summary>
internal class ContractFirstProcess
{
Expand Down

0 comments on commit f8fd084

Please sign in to comment.