diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index b6944af2f..53b181b22 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -2,132 +2,478 @@ # Licensed under the MIT License. name: $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) - trigger: branches: include: - - master -pr: none - -pool: - name: Azure Pipelines - vmImage: windows-latest - demands: - - msbuild - - vstest - -steps: -- task: NuGetCommand@2 - displayName: 'NuGet restore' - -- task: MSBuild@1 - displayName: 'Build solution **/*.sln' - inputs: - configuration: Release - -- task: VSTest@2 - displayName: 'XUnit Tests' - inputs: - testAssemblyVer2: | - **\*.Tests.dll - - vsTestVersion: 16.0 - codeCoverageEnabled: true - -- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 - displayName: 'ESRP CodeSigning' - inputs: - ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' - FolderPath: src - signConfigType: inlineSignParams - inlineOperation: | - [ - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolSign", - "parameters": [ - { - "parameterName": "OpusName", - "parameterValue": "Microsoft" - }, - { - "parameterName": "OpusInfo", - "parameterValue": "http://www.microsoft.com" - }, - { - "parameterName": "FileDigest", - "parameterValue": "/fd \"SHA256\"" - }, - { - "parameterName": "PageHash", - "parameterValue": "/NPH" - }, - { - "parameterName": "TimeStamp", - "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" - } - ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-230012", - "operationSetCode": "SigntoolVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - -- task: MSBuild@1 - displayName: 'Pack OpenAPI' - inputs: - solution: src/Microsoft.OpenApi/Microsoft.OpenApi.csproj - configuration: Release - msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg' - -- task: MSBuild@1 - displayName: 'Pack OpenAPI Readers' - inputs: - solution: src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj - configuration: Release - msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg' - -- task: MSBuild@1 - displayName: 'Pack OpenApi Hidi' - inputs: - solution: src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj - configuration: Release - msbuildArguments: '/t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory) /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg' - -- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1 - displayName: 'ESRP CodeSigning Nuget Packages' - inputs: - ConnectedServiceName: 'microsoftgraph ESRP CodeSign DLL and NuGet (AKV)' - FolderPath: '$(Build.ArtifactStagingDirectory)' - Pattern: '*.nupkg' - signConfigType: inlineSignParams - inlineOperation: | - [ - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetSign", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - }, - { - "keyCode": "CP-401405", - "operationSetCode": "NuGetVerify", - "parameters": [ ], - "toolName": "sign", - "toolVersion": "1.0" - } - ] - SessionTimeout: 20 - -- task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: Nugets' - inputs: - ArtifactName: Nugets \ No newline at end of file + - main + - support/v1 + - support/v2 + tags: + include: + - 'v*' +pr: + branches: + include: + - main + - support/v1 + - support/v2 + +variables: + buildPlatform: 'Any CPU' + buildConfiguration: 'Release' + ProductBinPath: '$(Build.SourcesDirectory)\src\Microsoft.OpenApi\bin\$(BuildConfiguration)' + REGISTRY: 'msgraphprodregistry.azurecr.io' + IMAGE_NAME: 'public/openapi/hidi' + PREVIEW_BRANCH: 'refs/heads/main' + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-2022 + os: windows + customBuildTags: + - ES365AIMigrationTooling + stages: + - stage: build + jobs: + - job: build + templateContext: + outputs: + - output: pipelineArtifact + displayName: 'Publish Artifact: Nugets' + artifactName: Nugets + targetPath: '$(Build.ArtifactStagingDirectory)/Nugets' + - output: pipelineArtifact + displayName: 'Publish Artifact: RepoFiles' + artifactName: RepoFiles + targetPath: '$(Build.ArtifactStagingDirectory)/RepoFiles' + steps: + - task: UseDotNet@2 + displayName: 'Use .NET 6' + inputs: + version: 6.x + + - task: UseDotNet@2 + displayName: 'Use .NET 8' + inputs: + version: 8.x + + # Install the nuget tool. + - task: NuGetToolInstaller@1 + displayName: 'Use NuGet >=6.11.0' + inputs: + versionSpec: '>=6.11.0' + checkLatest: true + + # Build the Product project + - task: DotNetCoreCLI@2 + displayName: 'build' + inputs: + projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln' + arguments: '--configuration $(BuildConfiguration) --no-incremental' + + # Run the Unit test + - task: DotNetCoreCLI@2 + displayName: 'test' + inputs: + command: test + projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.sln' + arguments: '--configuration $(BuildConfiguration) --no-build' + + - task: EsrpCodeSigning@5 + displayName: 'ESRP CodeSigning binaries' + inputs: + ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: 'akv-prod-eastus' + AuthCertName: 'ReferenceLibraryPrivateCert' + AuthSignCertName: 'ReferencePackagePublisherCertificate' + FolderPath: '$(Build.SourcesDirectory)\src' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: '20' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + PendingAnalysisWaitTimeoutMinutes: '5' + + # Pack core lib + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + displayName: 'pack OpenAPI' + + # Pack YamlReader + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + displayName: 'pack YamlReader' + + # Pack hidi + - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg + displayName: 'pack Hidi' + + - task: EsrpCodeSigning@5 + displayName: 'ESRP CodeSigning Nuget Packages' + inputs: + ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: 'akv-prod-eastus' + AuthCertName: 'ReferenceLibraryPrivateCert' + AuthSignCertName: 'ReferencePackagePublisherCertificate' + FolderPath: '$(Build.ArtifactStagingDirectory)' + Pattern: '*.nupkg' + signConfigType: 'inlineSignParams' + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [ ], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + PendingAnalysisWaitTimeoutMinutes: '5' + + # publish hidi as an .exe + - task: DotNetCoreCLI@2 + displayName: publish Hidi as executable + inputs: + command: 'publish' + arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi + projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj' + publishWebProjects: False + zipAfterPublish: false + + - task: CopyFiles@2 + displayName: Prepare staging folder for upload + inputs: + targetFolder: $(Build.ArtifactStagingDirectory)/Nugets + sourceFolder: $(Build.ArtifactStagingDirectory) + content: '*.nupkg' + + # Copy repository files to be used in the deploy stage + - task: CopyFiles@2 + displayName: 'Copy repository files for deploy stage' + inputs: + SourceFolder: '$(Build.SourcesDirectory)' + Contents: | + **/* + !**/bin/** + !**/obj/** + !**/.git/** + TargetFolder: '$(Build.ArtifactStagingDirectory)/RepoFiles' + + - stage: deploy + condition: and(or(contains(variables['Build.SourceBranch'], 'refs/tags/v'), eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH'])), succeeded()) + dependsOn: build + pool: + name: Azure-Pipelines-1ESPT-ExDShared + os: linux + image: ubuntu-latest + jobs: + - deployment: deploy_hidi + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' + + - deployment: deploy_lib + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg" + foreach($fileName in $fileNames) { + if(Test-Path $fileName) { + Remove-Item $fileName -Verbose + } + } + displayName: remove other nupkgs to avoid duplication + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' + + - deployment: deploy_yaml_reader + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: deploy_lib + environment: nuget-org + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - task: 1ES.PublishNuget@1 + displayName: 'NuGet push' + inputs: + packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg' + packageParentPath: '$(Pipeline.Workspace)' + nuGetFeedType: external + publishFeedCredentials: 'OpenAPI Nuget Connection' + + - deployment: create_github_release + condition: and(contains(variables['build.SourceBranch'], 'refs/tags/v'), succeeded()) + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Nugets + targetPath: '$(Pipeline.Workspace)' + dependsOn: [] + environment: kiota-github-releases + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - pwsh: | + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.", "" -replace ".nupkg", "" + #Set Variable $artifactName and $artifactVersion + Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" + echo "$artifactVersion" + displayName: 'Fetch Artifact Name' + - task: GitHubRelease@1 + displayName: 'GitHub release (edit)' + condition: succeededOrFailed() + inputs: + gitHubConnection: 'Github-MaggieKimani1' + action: edit + tagSource: userSpecifiedTag + tag: 'v$(artifactVersion)' + releaseNotesSource: inline + assets: '$(Pipeline.Workspace)\**\*.exe' + addChangeLog: false + + - deployment: deploy_docker_image + environment: docker-images-deploy + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: RepoFiles + targetPath: '$(Pipeline.Workspace)' + strategy: + runOnce: + deploy: + pool: + vmImage: 'ubuntu-latest' + steps: + - task: AzureCLI@2 + displayName: 'Login to Azure Container Registry' + inputs: + azureSubscription: 'ACR Images Push Service Connection' + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + az acr login --name $(REGISTRY) + + - pwsh: | + $content = [XML](Get-Content $(Pipeline.Workspace)/Directory.Build.props) + Write-Host "XML loaded, finding version..." + + # Handle PropertyGroup as either a single element or array + $version = $null + if ($content.Project.PropertyGroup -is [array]) { + Write-Host "PropertyGroup is an array, checking each entry..." + foreach ($pg in $content.Project.PropertyGroup) { + if ($pg.Version) { + $version = $pg.Version.ToString().Trim() + Write-Host "Found version in PropertyGroup array: $version" + break + } + } + } else { + # Single PropertyGroup + $version = $content.Project.PropertyGroup.Version + if ($version) { + $version = $version.ToString().Trim() + Write-Host "Found version in PropertyGroup: $version" + } + } + + if (-not $version) { + Write-Host "##vso[task.logissue type=error]Version not found in Directory.Build.props" + exit 1 + } + + Write-Host "Version found: $version" + Write-Host "##vso[task.setvariable variable=version;isoutput=true]$version" + Write-Host "##vso[task.setvariable variable=VERSION]$version" + displayName: 'Get version from csproj' + name: getversion + + - bash: | + # Debug output to verify version variable + echo "Version from previous step: $VERSION" + displayName: 'Verify version variable' + + - bash: | + echo "Build Number: $(Build.BuildNumber)" + # Extract the last 3 characters for the run number + runnumber=$(echo "$(Build.BuildNumber)" | grep -o '[0-9]\+$') + echo "Extracted Run Number: $runnumber" + + # If extraction fails, set a default + if [ -z "$runnumber" ]; then + echo "Extraction failed, using default value" + runnumber=$(date +"%S%N" | cut -c1-3) + echo "Generated fallback run number: $runnumber" + fi + + # Set the variable for later steps + echo "##vso[task.setvariable variable=RUNNUMBER]$runnumber" + echo "##vso[task.setvariable variable=RUNNUMBER;isOutput=true]$runnumber" + displayName: 'Get truncated run number' + name: getrunnumber + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + date=$(date +'%Y%m%d') + echo "Date value: $date" + echo "##vso[task.setvariable variable=BUILDDATE;isOutput=true]$date" + echo "##vso[task.setvariable variable=BUILDDATE]$date" + displayName: 'Get current date' + name: setdate + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - script: | + docker run --privileged --rm msgraphprodregistry.azurecr.io/tonistiigi/binfmt --install all + displayName: "Enable multi-platform builds" + + - script: | + docker buildx create --use --name mybuilder + displayName: "Set up Docker BuildX" + + - script: | + docker buildx inspect --bootstrap + displayName: "Ensure BuildX is working" + + - bash: | + echo "Building Docker image..." + echo "Using build date: ${BUILDDATE}" + # Using quotes around tags to prevent flag interpretation + docker buildx build \ + --platform linux/amd64,linux/arm64/v8 \ + --push \ + -t "$(REGISTRY)/$(IMAGE_NAME):nightly" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}.${BUILDDATE}${RUNNUMBER}" \ + "$(Pipeline.Workspace)" + + displayName: 'Build and Push Nightly Image' + condition: eq(variables['Build.SourceBranch'], variables['PREVIEW_BRANCH']) + + - bash: | + echo "Building Docker image for release..." + docker buildx build\ + --platform linux/amd64,linux/arm64/v8 \ + --push \ + -t "$(REGISTRY)/$(IMAGE_NAME):latest" \ + -t "$(REGISTRY)/$(IMAGE_NAME):${VERSION}" \ + "$(Pipeline.Workspace)" + displayName: 'Build and Push Release Image' + condition: contains(variables['Build.SourceBranch'], 'refs/tags/v') + +# once the nuget has been released, fill this form to get the public documentation updated. +# https://dev.azure.com/msft-skilling/Content/_workitems/create/User%20Story?templateId=39fb91e3-64a2-4c8a-83db-b2bdf3603dd3&ownerId=c4a28f90-17ae-4384-b514-7273392b082b +# https://learn.microsoft.com/en-us/dotnet/api/microsoft.openapi diff --git a/.config/1espt/PipelineAutobaseliningConfig.yml b/.config/1espt/PipelineAutobaseliningConfig.yml new file mode 100644 index 000000000..a4d9608c6 --- /dev/null +++ b/.config/1espt/PipelineAutobaseliningConfig.yml @@ -0,0 +1,22 @@ +## DO NOT MODIFY THIS FILE MANUALLY. This is part of auto-baselining from 1ES Pipeline Templates. Go to [https://aka.ms/1espt-autobaselining] for more details. + +pipelines: + 107: + usedNonDefaultBranch: true + retail: + source: + credscan: + lastModifiedDate: 2024-09-13 + eslint: + lastModifiedDate: 2024-09-13 + psscriptanalyzer: + lastModifiedDate: 2024-09-13 + armory: + lastModifiedDate: 2024-09-13 + binary: + credscan: + lastModifiedDate: 2025-01-27 + binskim: + lastModifiedDate: 2025-01-27 + spotbugs: + lastModifiedDate: 2025-01-27 diff --git a/.editorconfig b/.editorconfig index 49de0d370..e8f790dff 100644 --- a/.editorconfig +++ b/.editorconfig @@ -84,7 +84,7 @@ csharp_prefer_braces = true:silent csharp_style_deconstructed_variable_declaration = true:suggestion csharp_prefer_simple_default_expression = true:suggestion csharp_style_pattern_local_over_anonymous_function = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_inlined_variable_declaration = true:error ############################### # C# Formatting Rules # ############################### @@ -121,3 +121,14 @@ csharp_preserve_single_line_blocks = true [*.vb] # Modifier preferences visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion + + +# Verify settings +[*.{received,verified}.{txt,xml,json}] +charset = "utf-8-bom" +end_of_line = lf +indent_size = unset +indent_style = unset +insert_final_newline = false +tab_width = unset +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index bdb0cabc8..dea329be9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -15,3 +15,6 @@ *.PDF diff=astextplain *.rtf diff=astextplain *.RTF diff=astextplain + +# VerifyTests +*.verified.txt text eol=lf working-tree-encoding=UTF-8 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..af656d490 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @microsoft/openapi-write diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..a7d83e3dc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,24 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**OpenApi File To Reproduce** +Add the OpenApi file you're using or a link to it as well as the steps to reproduce the current behavior. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots/Code Snippets** +If applicable, add screenshots of the stack trace or a code snippet to help explain your problem. +If applicable, add a link to your project + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..021458556 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f3952729f..87b987112 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,13 +5,23 @@ updates: directory: "/" open-pull-requests-limit: 10 schedule: - interval: "weekly" - + interval: "daily" - package-ecosystem: "nuget" # location of package manifests directory: "/" open-pull-requests-limit: 10 schedule: interval: "daily" - -# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) \ No newline at end of file + groups: + MicrosoftExtensions: + patterns: + - "Microsoft.Extensions.*" + - package-ecosystem: dotnet-sdk + directory: / + schedule: + interval: "daily" + ignore: + - dependency-name: '*' + update-types: + - version-update:semver-major + - version-update:semver-minor diff --git a/.github/policies/OpenAPI.NET-branch-protection.yml b/.github/policies/OpenAPI.NET-branch-protection.yml new file mode 100644 index 000000000..2d8fd2a73 --- /dev/null +++ b/.github/policies/OpenAPI.NET-branch-protection.yml @@ -0,0 +1,119 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +# File initially created using https://github.com/MIchaelMainer/policyservicetoolkit/blob/main/branch_protection_export.ps1. + +name: OpenAPI.NET-branch-protection +description: Branch protection policy for the OpenAPI.NET repository +resource: repository +configuration: + branchProtectionRules: + + - branchNamePattern: main + # This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20: + # main + + # Specifies whether this branch can be deleted. boolean + allowsDeletions: false + # Specifies whether forced pushes are allowed on this branch. boolean + allowsForcePushes: false + # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean + dismissStaleReviews: true + # Specifies whether admins can overwrite branch protection. boolean + isAdminEnforced: true + # Indicates whether "Require a pull request before merging" is enabled. boolean + requiresPullRequestBeforeMerging: true + # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required + requiredApprovingReviewsCount: 1 + # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean + requireCodeOwnersReview: true + # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. + requiresCommitSignatures: false + # Are conversations required to be resolved before merging? boolean + requiresConversationResolution: true + # Are merge commits prohibited from being pushed to this branch. boolean + requiresLinearHistory: false + # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status + requiredStatusChecks: + - license/cla + - CodeQL + - Continuous Integration + # Require branches to be up to date before merging. boolean + requiresStrictStatusChecks: false + # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. + restrictsPushes: false + # Restrict who can dismiss pull request reviews. boolean + restrictsReviewDismissals: false + + - branchNamePattern: support/v1 + # This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20: + # support/v1 + + # Specifies whether this branch can be deleted. boolean + allowsDeletions: false + # Specifies whether forced pushes are allowed on this branch. boolean + allowsForcePushes: false + # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean + dismissStaleReviews: true + # Specifies whether admins can overwrite branch protection. boolean + isAdminEnforced: true + # Indicates whether "Require a pull request before merging" is enabled. boolean + requiresPullRequestBeforeMerging: true + # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required + requiredApprovingReviewsCount: 1 + # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean + requireCodeOwnersReview: true + # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. + requiresCommitSignatures: false + # Are conversations required to be resolved before merging? boolean + requiresConversationResolution: true + # Are merge commits prohibited from being pushed to this branch. boolean + requiresLinearHistory: false + # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status + requiredStatusChecks: + - license/cla + - CodeQL + - Continuous Integration + # Require branches to be up to date before merging. boolean + requiresStrictStatusChecks: false + # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. + restrictsPushes: false + # Restrict who can dismiss pull request reviews. boolean + restrictsReviewDismissals: false + + - branchNamePattern: support/v2 + # This branch pattern applies to the following branches as of approximately 02/27/2025 15:28:20: + # support/v1 + + # Specifies whether this branch can be deleted. boolean + allowsDeletions: false + # Specifies whether forced pushes are allowed on this branch. boolean + allowsForcePushes: false + # Specifies whether new commits pushed to the matching branches dismiss pull request review approvals. boolean + dismissStaleReviews: true + # Specifies whether admins can overwrite branch protection. boolean + isAdminEnforced: true + # Indicates whether "Require a pull request before merging" is enabled. boolean + requiresPullRequestBeforeMerging: true + # Specifies the number of pull request reviews before merging. int (0-6). Should be null/empty if PRs are not required + requiredApprovingReviewsCount: 1 + # Require review from Code Owners. Requires requiredApprovingReviewsCount. boolean + requireCodeOwnersReview: true + # Are commits required to be signed. boolean. TODO: all contributors must have commit signing on local machines. + requiresCommitSignatures: false + # Are conversations required to be resolved before merging? boolean + requiresConversationResolution: true + # Are merge commits prohibited from being pushed to this branch. boolean + requiresLinearHistory: false + # Required status checks to pass before merging. Values can be any string, but if the value does not correspond to any existing status check, the status check will be stuck on pending for status since nothing exists to push an actual status + requiredStatusChecks: + - license/cla + - CodeQL + - Continuous Integration + # Require branches to be up to date before merging. boolean + requiresStrictStatusChecks: false + # Indicates whether there are restrictions on who can push. boolean. Should be set with whoCanPush. + restrictsPushes: false + # Restrict who can dismiss pull request reviews. boolean + restrictsReviewDismissals: false + diff --git a/.github/policies/resourceManagement.yml b/.github/policies/resourceManagement.yml new file mode 100644 index 000000000..0fc5c93a2 --- /dev/null +++ b/.github/policies/resourceManagement.yml @@ -0,0 +1,101 @@ +id: +name: GitOps.PullRequestIssueManagement +description: GitOps.PullRequestIssueManagement primitive +owner: +resource: repository +disabled: false +where: +configuration: + resourceManagementConfiguration: + scheduledSearches: + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: 'status:waiting-for-author-feedback' + - hasLabel: + label: 'status:no-recent-activity' + - noActivitySince: + days: 3 + actions: + - closeIssue + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: 'status:waiting-for-author-feedback' + - noActivitySince: + days: 4 + - isNotLabeledWith: + label: 'status:no-recent-activity' + actions: + - addLabel: + label: 'status:no-recent-activity' + - addReply: + reply: This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for **4 days**. It will be closed if no further activity occurs **within 3 days of this comment**. + - description: + frequencies: + - hourly: + hour: 6 + filters: + - isIssue + - isOpen + - hasLabel: + label: 'status:duplicate' + - noActivitySince: + days: 1 + actions: + - addReply: + reply: This issue has been marked as duplicate and has not had any activity for **1 day**. It will be closed for housekeeping purposes. + - closeIssue + eventResponderTasks: + - if: + - payloadType: Issue_Comment + - isAction: + action: Created + - isActivitySender: + issueAuthor: True + - hasLabel: + label: 'status:waiting-for-author-feedback' + - isOpen + then: + - addLabel: + label: 'Needs: Attention :wave:' + - removeLabel: + label: 'status:waiting-for-author-feedback' + description: + - if: + - payloadType: Issues + - not: + isAction: + action: Closed + - hasLabel: + label: 'status:no-recent-activity' + then: + - removeLabel: + label: 'status:no-recent-activity' + description: + - if: + - payloadType: Issue_Comment + - hasLabel: + label: 'status:no-recent-activity' + then: + - removeLabel: + label: 'status:no-recent-activity' + description: + - if: + - payloadType: Pull_Request + then: + - inPrLabel: + label: WIP + description: +onFailure: +onSuccess: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..0d19e6ac4 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,54 @@ +# Pull Request + + + +## Description + + +## Type of Change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation update +- [ ] Other (please describe): + +## Related Issue(s) + + +## Changes Made + +- +- +- + +## Testing + +- [ ] Unit tests added/updated +- [ ] Integration tests added/updated +- [ ] Manual testing performed +- [ ] All existing tests pass + +## Checklist + +- [ ] My code follows the code style of this project +- [ ] I have performed a self-review of my own code +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes + +## Versions applicability + +- [ ] My change applies to the version 1.X of the library, if so PR link: +- [ ] My change applies to the version 2.X of the library, if so PR link: +- [ ] My change applies to the version 3.X of the library, if so PR link: +- [ ] I have evaluated the applicability of my change against the other versions above. + +See [the contributing guidelines](https://github.com/microsoft/OpenAPI.NET/blob/main/CONTRIBUTING.md) for more information about how patches are applied across multiple versions. + +## Additional Notes + \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 000000000..ce23f6ec0 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,10 @@ +manifest: true +primaryBranch: main +handleGHRelease: true +branches: + - branch: support/v1 + manifest: true + handleGHRelease: true + - branch: support/v2 + manifest: true + handleGHRelease: true \ No newline at end of file diff --git a/.github/workflows/auto-merge-dependabot.yml b/.github/workflows/auto-merge-dependabot.yml new file mode 100644 index 000000000..ba2243c97 --- /dev/null +++ b/.github/workflows/auto-merge-dependabot.yml @@ -0,0 +1,32 @@ +name: Auto-merge dependabot updates + +on: + pull_request: + branches: [ main ] + +permissions: + pull-requests: write + contents: write + +jobs: + + dependabot-merge: + + runs-on: ubuntu-latest + + if: ${{ github.actor == 'dependabot[bot]' }} + + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v2.5.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: Enable auto-merge for Dependabot PRs + # Only if version bump is not a major version change + if: ${{steps.metadata.outputs.update-type != 'version-update:semver-major'}} + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 610134cd0..c13b4d179 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -2,142 +2,96 @@ name: CI/CD Pipeline on: [push, pull_request, workflow_dispatch] +permissions: + contents: read + jobs: ci: name: Continuous Integration runs-on: ubuntu-latest - outputs: - latest_version: ${{ steps.tag_generator.outputs.new_version }} - is_default_branch: ${{ steps.conditionals_handler.outputs.is_default_branch }} env: ARTIFACTS_FOLDER: ${{ github.workspace }}/Artifacts GITHUB_RUN_NUMBER: ${{ github.run_number }} steps: - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v5 with: - dotnet-version: 5.0.x - - - name: Data gatherer - id: data_gatherer - shell: pwsh - run: | - # Get default branch - $repo = 'microsoft/OpenAPI.NET' - $defaultBranch = Invoke-RestMethod -Method GET -Uri https://api.github.com/repos/$repo | Select-Object -ExpandProperty default_branch - Write-Output "::set-output name=default_branch::$(echo $defaultBranch)" - - - name: Conditionals handler - id: conditionals_handler - shell: pwsh - run: | - $defaultBranch = "${{ steps.data_gatherer.outputs.default_branch }}" - $githubRef = "${{ github.ref }}" - $isDefaultBranch = 'false' - if ( $githubRef -like "*$defaultBranch*" ) { - $isDefaultBranch = 'true' - } - Write-Output "::set-output name=is_default_branch::$(echo $isDefaultBranch)" + dotnet-version: 8.x - name: Checkout repository id: checkout_repo - uses: actions/checkout@v2 + uses: actions/checkout@v6 with: token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 - - if: steps.conditionals_handler.outputs.is_default_branch == 'true' - name: Bump GH tag - id: tag_generator - uses: mathieudutour/github-tag-action@v6.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - default_bump: false - release_branches: ${{ steps.data_gatherer.outputs.default_branch }} - - name: Build projects id: build_projects shell: pwsh run: | - $projectsArray = @( - '.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj', - '.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj', - '.\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj' - ) - $gitNewVersion = if ("${{ steps.tag_generator.outputs.new_version }}") {"${{ steps.tag_generator.outputs.new_version }}"} else {$null} - $projectCurrentVersion = ([xml](Get-Content .\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj)).Project.PropertyGroup.Version - $projectNewVersion = $gitNewVersion ?? $projectCurrentVersion - - $projectsArray | ForEach-Object { - dotnet build $PSItem ` - -c Release # ` - # -o $env:ARTIFACTS_FOLDER ` - # /p:Version=$projectNewVersion - } - - # Move NuGet packages to separate folder for pipeline convenience - # New-Item Artifacts/NuGet -ItemType Directory - # Get-ChildItem Artifacts/*.nupkg | Move-Item -Destination "Artifacts/NuGet" + dotnet build Microsoft.OpenApi.sln -c Release - name: Run unit tests id: run_unit_tests shell: pwsh run: | - $testProjectsArray = @( - '.\test\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj', - '.\test\Microsoft.OpenApi.Readers.Tests\Microsoft.OpenApi.Readers.Tests.csproj', - '.\test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj' - ) + dotnet test Microsoft.OpenApi.sln -c Release -v n + + validate-trimming: + name: Validate Project for Trimming + runs-on: windows-latest + steps: + - uses: actions/checkout@v6 - $testProjectsArray | ForEach-Object { - dotnet test $PSItem ` - -c Release - } + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.x - # - if: steps.tag_generator.outputs.new_version != '' - # name: Upload NuGet packages as artifacts - # id: ul_packages_artifact - # uses: actions/upload-artifact@v1 - # with: - # name: NuGet packages - # path: Artifacts/NuGet/ + - name: Validate Trimming warnings + run: dotnet publish -c Release -r win-x64 /p:TreatWarningsAsErrors=true /warnaserror -f net8.0 + working-directory: ./test/Microsoft.OpenApi.Trimming.Tests - cd: - if: needs.ci.outputs.is_default_branch == 'true' && needs.ci.outputs.latest_version != '' - name: Continuous Deployment - needs: ci + validate-performance: + name: Validate performance of the library runs-on: ubuntu-latest + needs: [ci] steps: - # - name: Download and extract NuGet packages - # id: dl_packages_artifact - # uses: actions/download-artifact@v2 - # with: - # name: NuGet packages - # path: NuGet/ + - name: Checkout repository + uses: actions/checkout@v6 - # - name: Push NuGet packages to NuGet.org - # id: push_nuget_packages - # continue-on-error: true - # shell: pwsh - # run: | - # Get-ChildItem NuGet/*.nupkg | ForEach-Object { - # nuget push $PSItem ` - # -ApiKey $env:NUGET_API_KEY ` - # -Source https://api.nuget.org/v3/index.json - # } - # env: - # NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.x - - name: Create and publish release - id: create_release - uses: softprops/action-gh-release@v1 + - name: Copy committed results + run: | + mkdir -p ./performanceResults + cp -r ./performance/benchmark/BenchmarkDotNet.Artifacts/results/* ./performanceResults + + - name: Run performance tests + run: | + dotnet run -c Release + working-directory: ./performance/benchmark + + - name: Publish benchmark results + uses: actions/upload-artifact@v6 with: - name: OpenApi v${{ needs.ci.outputs.latest_version }} - tag_name: v${{ needs.ci.outputs.latest_version }} - # files: | - # NuGet/Microsoft.OpenApi.${{ needs.ci.outputs.latest_version }}.nupkg - # NuGet/Microsoft.OpenApi.Readers.${{ needs.ci.outputs.latest_version }}.nupkg + if-no-files-found: error + name: benchmark-results + path: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results" + + - name: Run comparison tool for empty models + run: dotnet run -c Release --project ./performance/resultsComparer/resultsComparer.csproj -- compare $OLD_REPORT $NEW_REPORT -p IdenticalMemoryUsage + shell: bash env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NEW_REPORT: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.EmptyModels-report.json" + OLD_REPORT: "${{ github.workspace }}/performanceResults/performance.EmptyModels-report.json" -# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) \ No newline at end of file + - name: Run comparison tool for descriptions + run: dotnet run -c Release --project ./performance/resultsComparer/resultsComparer.csproj -- compare $OLD_REPORT $NEW_REPORT -p ZeroPointTwoPercentDifferenceMemoryUsage + shell: bash + env: + NEW_REPORT: "${{ github.workspace }}/performance/benchmark/BenchmarkDotNet.Artifacts/results/performance.Descriptions-report.json" + OLD_REPORT: "${{ github.workspace }}/performanceResults/performance.Descriptions-report.json" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 347ff8bca..30c8acef4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,10 +2,16 @@ name: CodeQL Analysis on: push: - branches: [ vnext ] + branches: [ main, support/v1, support/v2 ] pull_request: schedule: - cron: '0 8 * * *' + workflow_dispatch: + +permissions: + contents: read # these permissions are required to run the codeql analysis + actions: read + security-events: write jobs: analyze: @@ -14,16 +20,16 @@ jobs: steps: - name: Checkout repository id: checkout_repo - uses: actions/checkout@v2 + uses: actions/checkout@v6 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v5 with: - dotnet-version: 5.0.x + dotnet-version: 8.0.x - name: Initialize CodeQL id: init_codeql - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v4 with: queries: security-and-quality @@ -33,7 +39,7 @@ jobs: run: | $projectsArray = @( '.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj', - '.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj', + '.\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj', '.\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj' ) @@ -43,6 +49,6 @@ jobs: - name: Perform CodeQL Analysis id: analyze_codeql - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v4 # Built with ❤ by [Pipeline Foundation](https://pipeline.foundation) \ No newline at end of file diff --git a/.github/workflows/release-please-gha.yml b/.github/workflows/release-please-gha.yml new file mode 100644 index 000000000..c905a3f48 --- /dev/null +++ b/.github/workflows/release-please-gha.yml @@ -0,0 +1,43 @@ +## ----------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See LICENSE.txt in the project root for license information. +## ----------------------------------------------------------------------------- +# +# Summary: +# This GitHub Actions workflow automates the release process using Release Please. +# It triggers on pushes to the main branch, generates a GitHub App token using organization +# variables and secrets, and then runs the release-please-action to manage versioning and changelogs. + +name: Release Please + +on: + push: + branches: + - main + - support/v1 + - support/v2 + workflow_dispatch: + +permissions: + contents: read + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@v2 + with: + app-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }} + private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }} + + - name: Release Please + uses: googleapis/release-please-action@v4 + with: + token: ${{ steps.app-token.outputs.token }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + target-branch: ${{ github.ref_name }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000..7cd77844c --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,68 @@ +name: Sonarcloud +on: + workflow_dispatch: + push: + branches: + - main + paths-ignore: ['.vscode/**'] + pull_request: + types: [opened, synchronize, reopened] + paths-ignore: ['.vscode/**'] + + +permissions: + contents: read + pull-requests: read + +env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + +jobs: + checksecret: + name: check if SONAR_TOKEN is set in github secrets + runs-on: ubuntu-latest + outputs: + is_SONAR_TOKEN_set: ${{ steps.checksecret_job.outputs.is_SONAR_TOKEN_set }} + steps: + - name: Check whether unity activation requests should be done + id: checksecret_job + run: | + echo "is_SONAR_TOKEN_set=${{ env.SONAR_TOKEN != '' }}" >> $GITHUB_OUTPUT + build: + needs: [checksecret] + if: needs.checksecret.outputs.is_SONAR_TOKEN_set == 'true' + name: Build + runs-on: windows-latest + steps: + - name: Set up JDK 17 + uses: actions/setup-java@v5 + with: + distribution: 'adopt' + java-version: 17 + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: 8.0.x + - uses: actions/checkout@v6 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Cache SonarCloud packages + uses: actions/cache@v5 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Install SonarCloud scanner + run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + CollectCoverage: true + CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682 + shell: pwsh + run: | + dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml" + dotnet workload restore + dotnet build + dotnet test Microsoft.OpenApi.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" \ No newline at end of file diff --git a/.gitignore b/.gitignore index 940794e60..258fee87a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. ## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore # User-specific files *.suo @@ -88,6 +88,7 @@ ipch/ *.VC.VC.opendb # Visual Studio profiler +*.diagsession *.psess *.vsp *.vspx @@ -286,3 +287,7 @@ __pycache__/ *.btm.cs *.odx.cs *.xsd.cs + +# BenchmarkDotNet profiler files +*.nettrace +*.speedscope.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 000000000..9d7db69f9 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "3.1.2" +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index c26bf0c9f..66912fac4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,19 +4,68 @@ { // Use IntelliSense to find out which attributes exist for C# debugging // Use hover for the description of the existing attributes - // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md - "name": ".NET Core Launch (console)", + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/main/debugger-launchjson.md + "name": "Launch Hidi", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/netcoreapp3.1/Microsoft.OpenApi.Hidi.dll", - "args": [], + "program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net8.0/Microsoft.OpenApi.Hidi.dll", + "args": ["plugin", + "-m","${workspaceFolder}/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/exampleapimanifest.json", + "--of","./output"], "cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi", // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console "console": "internalConsole", "stopAtEntry": false }, + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/main/debugger-launchjson.md + "name": "Launch Benchmark", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/performance/benchmark/bin/Release/net8.0/PerformanceTests.dll", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false, + }, + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/main/debugger-launchjson.md + "name": "Launch Results comparer", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/performance/resultsComparer/bin/Debug/net8.0/resultsComparer.dll", + "cwd": "${workspaceFolder}/performance/resultsComparer", + "args": ["compare"], + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false, + "requireExactSource": false, + }, + { + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/main/debugger-launchjson.md + "name": "Launch Workbench", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/src/Microsoft.OpenApi.WorkBench/bin/Debug/net8.0-windows/Microsoft.OpenApi.Workbench.exe", + "args": [], + "cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Workbench", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, { "name": ".NET Core Attach", "type": "coreclr", diff --git a/.vscode/settings.json b/.vscode/settings.json index 0313280bf..186b10bea 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,9 @@ "activityBar.background": "#03323C", "titleBar.activeBackground": "#054754", "titleBar.activeForeground": "#F0FCFE" - } + }, + "cSpell.words": [ + "csdl", + "Hidi" + ] } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 358fd0e1a..d2bd5722f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -5,16 +5,43 @@ "tasks": [ { "label": "build", - "type": "shell", - "command": "msbuild", + "command": "dotnet", + "type": "process", + "group": "build", + "args": [ + "build", + "${workspaceFolder}/Microsoft.OpenApi.sln", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "test", + "command": "dotnet", + "type": "process", + "group": "test", "args": [ + "test", + "${workspaceFolder}/Microsoft.OpenApi.sln", "/property:GenerateFullPaths=true", - "/t:build" + "/consoleloggerparameters:NoSummary", + "--collect:\"XPlat Code Coverage\"" ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", "group": "build", - "presentation": { - "reveal": "silent" - }, + "args": [ + "watch", + "run", + "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], "problemMatcher": "$msCompile" }, { diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..c6ae3ebea --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,688 @@ +# Changelog + +## [3.1.2](https://github.com/microsoft/OpenAPI.NET/compare/v3.1.1...v3.1.2) (2026-01-06) + +### Bug Fixes + +* correct error pointer when extension parser throws OpenApiException ([43c75a9](https://github.com/microsoft/OpenAPI.NET/commit/43c75a90746344fcc975611100e995fe4045edf0)) +* wrap extension parser calls in try-catch to ensure correct error pointers ([50b44aa](https://github.com/microsoft/OpenAPI.NET/commit/50b44aad12d8fa86a46f7f6d62896a7b1c344d2e)) + +## [3.1.1](https://github.com/microsoft/OpenAPI.NET/compare/v3.1.0...v3.1.1) (2025-12-18) + + +### Bug Fixes + +* **schema:** always serialize `additionalProperties: false` ([6651c36](https://github.com/microsoft/OpenAPI.NET/commit/6651c36ff341329c053776d65b36b1b7fa9dd3ea)) +* **schema:** always serialize `additionalProperties: false` ([e36fc95](https://github.com/microsoft/OpenAPI.NET/commit/e36fc9565bce42916eb7bf64d1f74d491dd1f407)) + +## [3.1.0](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.3...v3.1.0) (2025-12-17) + +### Features + +* Add `type: "null"` downcasting when in oneOf and anyOf for OpenAPI v3 ([782cf8d](https://github.com/microsoft/OpenAPI.NET/commit/782cf8d1ff8166e3c7be706e08dabf168b9616a4)) + +## [3.0.3](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.2...v3.0.3) (2025-12-16) + + +* load JSON documents that are preceded by multiple whitespace ([6461bac](https://github.com/microsoft/OpenAPI.NET/commit/6461bac01c4176424210e9ac249698f665a514a6)) +* non-seekable json streams would fail to load as a document ([2436d73](https://github.com/microsoft/OpenAPI.NET/commit/2436d7382bfbf8b9ba501d88f682e952bdf27146)) +* reading streams in an asp.net context would cause async exceptions ([f9e5248](https://github.com/microsoft/OpenAPI.NET/commit/f9e524859722476b3111cb6006f77208c2d1f526)) + +## [3.0.2](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.1...v3.0.2) (2025-12-08) + +### Bug Fixes + +* additional properties serialization should not emit a schema in v2 ([946cba9](https://github.com/microsoft/OpenAPI.NET/commit/946cba992a2733a60182453e38722b4ed789b729)) +* additional properties serialization should not emit booleans in v3.1+ ([946cba9](https://github.com/microsoft/OpenAPI.NET/commit/946cba992a2733a60182453e38722b4ed789b729)) + +## [3.0.1](https://github.com/microsoft/OpenAPI.NET/compare/v3.0.0...v3.0.1) (2025-11-17) + +### Bug Fixes + +* empty strings should be quoted in yaml ([8d215f9](https://github.com/microsoft/OpenAPI.NET/commit/8d215f9ea8a780b1e2e8dd6cefb8d470cc35682d)) +* empty strings should be quoted in yaml ([0ca10db](https://github.com/microsoft/OpenAPI.NET/commit/0ca10db3bb9ffa937dd35862068926f3586d6991)) + +## [3.0.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.9...v3.0.0) (2025-11-11) + +### ⚠ BREAKING CHANGES + +* adds support for OpenAPI 3.2.0 + +> Note: Please refer to the [upgrade guide](https://github.com/microsoft/OpenAPI.NET/blob/main/docs/upgrade-guide-3.md) for a detailed description of the breaking changes. + +> Note: ASP.net users should remain on version 1.X for ASP.net < 10, and version 2.X for ASP.net 10, this new major version will be implemented in a future version of ASP.net, [more information](https://github.com/microsoft/OpenAPI.NET/blob/main/CONTRIBUTING.md#branches-and-support-policy) + +### Features + +* adds support for OpenAPI 3.2.0 ([765a8dd](https://github.com/microsoft/OpenAPI.NET/commit/765a8dd4d6efd1a31b6a76d282ccffa5877a845a)) + +## [2.4.2](https://github.com/microsoft/OpenAPI.NET/compare/v2.4.1...v2.4.2) (2025-12-22) + + +### Bug Fixes + +* wrap extension parser calls in try-catch to ensure correct error pointers ([63cf4a3](https://github.com/microsoft/OpenAPI.NET/commit/63cf4a3029fe2d285a6fe2724e30ffcf3bdd2f9f)) +* wrap extension parser calls in try-catch to ensure correct error pointers ([458cabe](https://github.com/microsoft/OpenAPI.NET/commit/458cabe6cd0fbdb192dbd17f2d6ab3b8162d1166)) + +## [2.4.1](https://github.com/microsoft/OpenAPI.NET/compare/v2.4.0...v2.4.1) (2025-12-18) + +### Bug Fixes + +* **schema:** always serialize `additionalProperties: false` ([6651c36](https://github.com/microsoft/OpenAPI.NET/commit/6651c36ff341329c053776d65b36b1b7fa9dd3ea)) +* **schema:** always serialize `additionalProperties: false` ([e36fc95](https://github.com/microsoft/OpenAPI.NET/commit/e36fc9565bce42916eb7bf64d1f74d491dd1f407)) + +## [2.4.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.12...v2.4.0) (2025-12-17) + +### Features + +* Add `type: "null"` downcasting when in oneOf and anyOf for OpenAPI v3 ([782cf8d](https://github.com/microsoft/OpenAPI.NET/commit/782cf8d1ff8166e3c7be706e08dabf168b9616a4)) + +## [2.3.12](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.11...v2.3.12) (2025-12-15) + +### Bug Fixes + +* load JSON documents that are preceded by multiple whitespace ([640e59a](https://github.com/microsoft/OpenAPI.NET/commit/640e59a143a2a6d3b79c9f6a97a6029593d7dd8f)) +* non-seekable json streams would fail to load as a document ([76b0159](https://github.com/microsoft/OpenAPI.NET/commit/76b0159d12790ab00310ff107e37396ecdf13336)) +* non-seekable json streams would fail to load as a document ([2436d73](https://github.com/microsoft/OpenAPI.NET/commit/2436d7382bfbf8b9ba501d88f682e952bdf27146)) +* reading streams in an asp.net context would cause async exceptions ([f9e5248](https://github.com/microsoft/OpenAPI.NET/commit/f9e524859722476b3111cb6006f77208c2d1f526)) + +## [2.3.11](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.10...v2.3.11) (2025-12-08) + +### Bug Fixes + +* additional properties serialization should not emit a schema in v2 ([946cba9](https://github.com/microsoft/OpenAPI.NET/commit/946cba992a2733a60182453e38722b4ed789b729)) +* additional properties serialization should not emit a schema in v2 fix: additional properties serialization should not emit booleans in v3.1+ ([275dd9d](https://github.com/microsoft/OpenAPI.NET/commit/275dd9d7525b1f490eccaf1e6e60829ae51bdf5d)) +* additional properties serialization should not emit booleans in v3.1+ ([946cba9](https://github.com/microsoft/OpenAPI.NET/commit/946cba992a2733a60182453e38722b4ed789b729)) + +## [2.3.10](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.9...v2.3.10) (2025-11-17) + +* empty strings should be quoted in yaml ([e919b33](https://github.com/microsoft/OpenAPI.NET/commit/e919b33e9d09159217066248483ef4c767865c82)) +* empty strings should be quoted in yaml ([0ca10db](https://github.com/microsoft/OpenAPI.NET/commit/0ca10db3bb9ffa937dd35862068926f3586d6991)) + +## [2.3.9](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.8...v2.3.9) (2025-11-06) + +### Bug Fixes + +* a bug where null sentinel value would appear in YAML documents ([0e864c7](https://github.com/microsoft/OpenAPI.NET/commit/0e864c73791b8610a95f06da9fbb44bfa1cf75a9)) +* a bug where null sentinel value would appear in YAML documents ([15618e1](https://github.com/microsoft/OpenAPI.NET/commit/15618e1f6a79874ae61dc31e3bcd5e1f3177d7ff)) + +## [2.3.8](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.7...v2.3.8) (2025-10-27) + + +### Bug Fixes + +* an issue where numeric property names would be missing quotes in yaml conversion ([da43c98](https://github.com/microsoft/OpenAPI.NET/commit/da43c98cfd7938a2354bfe57f431aa4bd0407b66)) +* an issue where numeric property names would be missing quotes in yaml conversion ([234504c](https://github.com/microsoft/OpenAPI.NET/commit/234504c6a1a53be8630b1f2eda8640f04a92327d)) +* quote property names in yaml that match boolean values ([39a9f41](https://github.com/microsoft/OpenAPI.NET/commit/39a9f4112a123b9207504d4a840a9be553703555)) +* yaml blocks and line returns ([b053848](https://github.com/microsoft/OpenAPI.NET/commit/b05384872e9364aedf8d8fc24b36bab9824594c5)) +* yaml multi-line literals maintain their lines ([558a1ce](https://github.com/microsoft/OpenAPI.NET/commit/558a1ceafc22e6075470a8799582575c8c1e125d)) + +## [2.3.7](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.6...v2.3.7) (2025-10-24) + + +### Bug Fixes + +* adds a null value sentinel to enable roundtrip serializations of JsonNode typed properties ([337c6eb](https://github.com/microsoft/OpenAPI.NET/commit/337c6eb08a9cc99bfbe2cd08fed61678030b8b8b)) +* adds a null value sentinel to enable roundtrip serializations of JsonNode typed properties ([63b2b98](https://github.com/microsoft/OpenAPI.NET/commit/63b2b98b64633fdef3b7fafee882060a3e0808fd)) +* fixes a bug where yaml null values would end up as a string "null" during roundtrip serialization ([6e62de2](https://github.com/microsoft/OpenAPI.NET/commit/6e62de205f0a5d58b385b4536dc30035a9977054)) +* fixes a bug where yaml null values would end up as a string "null" during roundtrip serialization ([994184b](https://github.com/microsoft/OpenAPI.NET/commit/994184b41bcd433a078cdeef75ba43d92b6b9762)) +* YamlConverter adding extra quotes to string values when converting from JSON to YAML ([ccfebc8](https://github.com/microsoft/OpenAPI.NET/commit/ccfebc828c2793b00faf3d5b12bd95bc68901104)) + + +### Performance Improvements + +* do not duplicate nodes when indexing ([dbbbf13](https://github.com/microsoft/OpenAPI.NET/commit/dbbbf1330934bc35fb35610a6a5db65514596c48)) +* only initialize map node nodes on demand ([bdb5264](https://github.com/microsoft/OpenAPI.NET/commit/bdb5264bc41b345f9ea95924ca5ab679178b82b6)) +* reduce allocations in mapnode ([f58aad2](https://github.com/microsoft/OpenAPI.NET/commit/f58aad235f904f94704aa14700aaca4ac16205af)) +* removes the lazy initialization since the node is always enumerated ([1c96521](https://github.com/microsoft/OpenAPI.NET/commit/1c96521c82cfa7414602e4f4da64e629b6c69c29)) +* switches to lazy instantiation ([d3c758b](https://github.com/microsoft/OpenAPI.NET/commit/d3c758b0d4421d1da9979587dfaee91bbdee0c7c)) +* use deep equals for comparison to reduce allocations ([6ce3214](https://github.com/microsoft/OpenAPI.NET/commit/6ce3214ad3beb5abe6045e5aa1743db4249c1974)) + +## [2.3.6](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.5...v2.3.6) (2025-10-20) + + +### Bug Fixes + +* a bug where empty collections would not be serialized for default values ([4c4d257](https://github.com/microsoft/OpenAPI.NET/commit/4c4d257c0cf10d1742fae9f3961e4a6242c0ce1d)) + +## [2.3.5](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.4...v2.3.5) (2025-10-14) + + +### Bug Fixes + +* use settings for terse output in serialization extension methods ([246039b](https://github.com/microsoft/OpenAPI.NET/commit/246039bfa8a16c042a10a87126289de82d18b321)) +* use settings for terse output in serialization extension methods ([8b91278](https://github.com/microsoft/OpenAPI.NET/commit/8b912788ef18b44a083d3fd2a1d6e25c9e6e17cb)) + +## [2.3.4](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.3...v2.3.4) (2025-10-06) + + +### Bug Fixes + +* Improve server creation and URL handling logic to maintain port ([3e6ee80](https://github.com/microsoft/OpenAPI.NET/commit/3e6ee80491ab32d810d40f29761b8eb8e4c4ce23)) +* missing deserialization for header content property in 3.1 and 3.0 ([717f154](https://github.com/microsoft/OpenAPI.NET/commit/717f1547bf94c3e9f76078d9a3b93ce684e17306)) +* missing deserialization for header content property in 3.1 and 3.0 ([0fdfae1](https://github.com/microsoft/OpenAPI.NET/commit/0fdfae1b0bf4d371af8ad3bfa6ad4df3da8d545b)) + +## [2.3.3](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.2...v2.3.3) (2025-10-02) + + +### Bug Fixes + +* typo in allowReserved property name for deserialization ([1633453](https://github.com/microsoft/OpenAPI.NET/commit/16334536dcb5182f26c0d58463bd15a124dd1505)) +* typo in allowReserved property name for deserialization ([f7e34be](https://github.com/microsoft/OpenAPI.NET/commit/f7e34be28566a4f714d43667f8c43be7159d27a2)) + +## [2.3.2](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.1...v2.3.2) (2025-09-19) + + +### Bug Fixes + +* Fix URL processing in InternalLoad method would not detect the filename/scheme properly in some scenarios ([d93689c](https://github.com/microsoft/OpenAPI.NET/commit/d93689c87ababdf64a82dc492a19b963f65b3fd1)) +* OpenApiEncoding explode property serialization defaults with form style ([ae03eab](https://github.com/microsoft/OpenAPI.NET/commit/ae03eaba3fe7aa20bf0d03f895bbd4ae85d9d344)) + +## [2.3.1](https://github.com/microsoft/OpenAPI.NET/compare/v2.3.0...v2.3.1) (2025-09-08) + + +### Bug Fixes + +* file access for "file" URI scheme with special characters ([6dded81](https://github.com/microsoft/OpenAPI.NET/commit/6dded810cfba50d3a8093795a9359c384dd52c6a)) + +## [2.3.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.2.0...v2.3.0) (2025-08-29) + + +### Features + +* adds the detected format as part of the diagnostic ([#2482](https://github.com/microsoft/OpenAPI.NET/issues/2482)) ([59d7c81](https://github.com/microsoft/OpenAPI.NET/commit/59d7c81fae8cbc320a9005c529806e94cc4e9444)) +* adds the detected format to the diagnostics ([59d7c81](https://github.com/microsoft/OpenAPI.NET/commit/59d7c81fae8cbc320a9005c529806e94cc4e9444)) + +## [2.2.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.1.0...v2.2.0) (2025-08-25) + + +### Features + +* add Validation Rule for path operations to not have a request body ([d101fc3](https://github.com/microsoft/OpenAPI.NET/commit/d101fc30cfc701f2d6c52a51b9e39fa7eae96194)) + + +### Bug Fixes + +* missing examples when one example is with an empty array. ([cb1c496](https://github.com/microsoft/OpenAPI.NET/commit/cb1c4967f37f11dad6ad42784e6c3cf8570081f9)) + +## [2.1.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.1...v2.1.0) (2025-08-20) + + +### Features + +* adds a default validation rule for unresolved references ([90b3966](https://github.com/microsoft/OpenAPI.NET/commit/90b3966e5e071e26570050733482660f41f944b0)) + + +### Bug Fixes + +* Improve OpenApiWalker performance ([a007c03](https://github.com/microsoft/OpenAPI.NET/commit/a007c039eb2a9190d4adeafd865f6d42df4221aa)) +* Validate schema property is not null ([3326022](https://github.com/microsoft/OpenAPI.NET/commit/3326022b016fd3fc795f45926a55895b02557a09)) + +## [2.0.1](https://github.com/microsoft/openapi.net/compare/v2.0.0...v2.0.1) (2025-08-18) + + +### Bug Fixes + +* add missing disposable for stream ([9318c00](https://github.com/microsoft/openapi.net/commit/9318c00c31466bf67d2e9701659a4cda3d82d1dd)) +* add missing disposable for stream ([0c1ccbd](https://github.com/microsoft/openapi.net/commit/0c1ccbdc1ba4c53662ff6c7132366ae435d8fedb)) + +## [2.0.0](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.31...v2.0.0) (2025-07-10) + + +### Features + +* General availability of version 2 with support for OpenAPI 3.1!!! 🎉🎉🎉 ([a02d74c](https://github.com/microsoft/OpenAPI.NET/commit/a02d74c2467d591a7c4d8fa89b3b18e2452be0a5)) +* General availability of version 2 with support for OpenAPI 3.1!!! 🎉🎉🎉 ([97824e5](https://github.com/microsoft/OpenAPI.NET/commit/97824e5a9dc36b0c2ac56bbceef3439b9e8dfcf3)) + + +### Bug Fixes + +* inconsistent visibility of properties in current keys class ([cb9772f](https://github.com/microsoft/OpenAPI.NET/commit/cb9772fd4eb2a6fa36b65f0388f471eb66653aa2)) +* removes extraneous default value constant ([bf8d0b6](https://github.com/microsoft/OpenAPI.NET/commit/bf8d0b63adc16013fdb22f38715f167ce6e21c98)) +* removes extraneous default value constant ([b6eb46e](https://github.com/microsoft/OpenAPI.NET/commit/b6eb46ebb46ccd7314e00b5698fa7f6b9b6ae0da)) +* removes loop methods from parsing context as its available in loop detector instead ([de3531b](https://github.com/microsoft/OpenAPI.NET/commit/de3531bc944bcb2bbc55e278e28f1a05d6d0a29f)) +* removes loop methods from parsing context as its available in loop detector instead ([18a8cbe](https://github.com/microsoft/OpenAPI.NET/commit/18a8cbeeb00ee39e5bbdaabdde097ee9f8a75668)) +* removes public mermaid types that were not usuable ([ef7ae33](https://github.com/microsoft/OpenAPI.NET/commit/ef7ae338dc6122a9ffc58c7661b161b319d307d9)) +* removes public mermaid types that were not usuable ([a26096c](https://github.com/microsoft/OpenAPI.NET/commit/a26096c8cf9c3e53a547235a446296eaff3f413d)) +* removes redundant marker interface ([5a055f9](https://github.com/microsoft/OpenAPI.NET/commit/5a055f9f616028116f1d035ee744820f37a85464)) +* removes redundant marker interface ([74a9f08](https://github.com/microsoft/OpenAPI.NET/commit/74a9f083674134482b1349bce1643d9f4636ed82)) +* switches to a getter for API consistency ([7975082](https://github.com/microsoft/OpenAPI.NET/commit/797508257501c8b4a336310c84030d0e128caf14)) +* switches to a getter for API consistency ([0091f1c](https://github.com/microsoft/OpenAPI.NET/commit/0091f1cbf5f430fe9f54cfb5e2b66279663de632)) +* unconsistent visibility of properties in current keys class ([d0c20ab](https://github.com/microsoft/OpenAPI.NET/commit/d0c20ab2209b3e7ed57cb89dbd4107d915975302)) +* visibility of extension methods ([1e9112a](https://github.com/microsoft/OpenAPI.NET/commit/1e9112a4cfc01a54f265858c81b0effb8a897976)) +* visibility of extension methods ([50c8e34](https://github.com/microsoft/OpenAPI.NET/commit/50c8e3459d9849d0f9acfc1e7efc99668828e8a4)) + +## [2.0.0-preview.31](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.30...v2.0.0-preview.31) (2025-07-02) + + +### Bug Fixes + +* bumps openapi.net.odata to fix two critical bugs in hidi ([00c3018](https://github.com/microsoft/OpenAPI.NET/commit/00c30181214b35f4817be0cbd3827d765efd04d9)) +* bumps openapi.net.odata to fix two critical bugs in hidi ([cf41355](https://github.com/microsoft/OpenAPI.NET/commit/cf41355aac3326c1cb9337078de989179f1b3b67)) + +## [2.0.0-preview.30](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.29...v2.0.0-preview.30) (2025-07-02) + + +### Bug Fixes + +* migration of hidi to the latest version of system.commandline ([a5f8721](https://github.com/microsoft/OpenAPI.NET/commit/a5f8721a18e93ee881cfee371ba6d23ce0c55ae4)) +* throw on circular reference ([e14258d](https://github.com/microsoft/OpenAPI.NET/commit/e14258dd2a8639702c8e0bc81a643874d207facb)) +* throw on circular reference ([caea292](https://github.com/microsoft/OpenAPI.NET/commit/caea292b39d2c754bd2e2d214280add53a0a47ea)) +* upgrades openapi.odata to avoid hidi failing to load ([0bea5ed](https://github.com/microsoft/OpenAPI.NET/commit/0bea5ed3cbb10230bf026288e118ce0e5025e55a)) +* upgrades openapi.odata to avoid hidi failing to load ([6735397](https://github.com/microsoft/OpenAPI.NET/commit/67353976b8a17dcb6760223d06c097469fa6f794)) +* validation to accept lowercase status code ranges (4xx, 5xx) in OpenAPI responses ([09f661f](https://github.com/microsoft/OpenAPI.NET/commit/09f661f0ff0511d5937fad49ae8a6182b1ea1aff)) + +## [2.0.0-preview.29](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.28...v2.0.0-preview.29) (2025-06-18) + + +### Bug Fixes + +* avoid stack overflow on cyclical references ([06cc025](https://github.com/microsoft/OpenAPI.NET/commit/06cc025dca43d24955bcd205facefa4347d3f0c7)) + +## [2.0.0-preview.28](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.27...v2.0.0-preview.28) (2025-06-16) + + +### Bug Fixes + +* sub-schema references are invalid ([92db49b](https://github.com/microsoft/OpenAPI.NET/commit/92db49b98ade782de3dec229936c100a1339b491)) +* sub-schema references are invalid ([75d1d2b](https://github.com/microsoft/OpenAPI.NET/commit/75d1d2b62a6fab3727047be5c0e10b9987ad9f37)) + +## [2.0.0-preview.27](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.26...v2.0.0-preview.27) (2025-06-13) + + +### Bug Fixes + +* implementation drift between the different version services ([1ed02e3](https://github.com/microsoft/OpenAPI.NET/commit/1ed02e3cbe7a6b484ee7db224e056ae2f0244a30)) +* implementation drift between the different version services ([2514526](https://github.com/microsoft/OpenAPI.NET/commit/25145266a70a961e6899368951d95ce41fe55f5b)) +* relative uri in json schema references would not parse appropriately or provide feedback to the user ([940945d](https://github.com/microsoft/OpenAPI.NET/commit/940945df29bea338a22553a3ddfb7e61853cb4e7)) +* relative uri in json schema references would not parse appropriately or provide feedback to the user ([e0bceaa](https://github.com/microsoft/OpenAPI.NET/commit/e0bceaaa39e8e475652b390324254149e867f39f)) +* warn instead of error out when $schema is present in the document ([388d6f7](https://github.com/microsoft/OpenAPI.NET/commit/388d6f79b4b45d1c30bddbff66dd79eef2d4e4b7)) +* warn instead of error out when $schema is present in the document ([7c7b053](https://github.com/microsoft/OpenAPI.NET/commit/7c7b053b543ebdedf05b0357175fea3dc9d345db)) + +## [2.0.0-preview.26](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.25...v2.0.0-preview.26) (2025-06-12) + + +### Bug Fixes + +* a bug where relative relative and sub-component JSON references would not resolve properly ([b7bc6be](https://github.com/microsoft/OpenAPI.NET/commit/b7bc6be4a05f1001130efb9af0b677dbec3055bc)) +* a bug where relative relative and sub-component JSON references would not resolve properly ([c53165c](https://github.com/microsoft/OpenAPI.NET/commit/c53165c72fae25ba0864a9f3c52d42e4ee05184d)) +* recursive relative reference resolution ([873acd4](https://github.com/microsoft/OpenAPI.NET/commit/873acd45eb6adecdc4219a08b028ddf35a568f01)) +* recursive relative reference resolution ([f296505](https://github.com/microsoft/OpenAPI.NET/commit/f296505b7123f35b2e45eedc9118c59b8f925cbd)) +* upgrades sharp yaml to avodi signing issues on netfx ([5dc7e81](https://github.com/microsoft/OpenAPI.NET/commit/5dc7e81fa7fad856edd96640ea7ee0e23e25a7f2)) +* upgrades sharp yaml to avodi signing issues on netfx ([4db5c1a](https://github.com/microsoft/OpenAPI.NET/commit/4db5c1ae39d4bc6c5138fda5d9d14904f069fa3e)) + +## [2.0.0-preview.25](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.24...v2.0.0-preview.25) (2025-06-10) + + +### Bug Fixes + +* ci configuration ([e7f76f7](https://github.com/microsoft/OpenAPI.NET/commit/e7f76f753649d5747a720b55babe2c59bbedfd49)) +* ci configuration ([a8fd917](https://github.com/microsoft/OpenAPI.NET/commit/a8fd91728bc57102d36bfdb6442e3c273b2818e6)) + +## [2.0.0-preview.24](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.23...v2.0.0-preview.24) (2025-06-09) + + +### Bug Fixes + +* callback reference annotations parsing ([86892b3](https://github.com/microsoft/OpenAPI.NET/commit/86892b361c7dcbe445ddfe10fd57fd9ab2d8a5a9)) +* example reference annotation parsing ([8bf012b](https://github.com/microsoft/OpenAPI.NET/commit/8bf012b7d576f5efd6d0953859b98494958c2c4e)) +* link reference annotations parsing ([2a62c5a](https://github.com/microsoft/OpenAPI.NET/commit/2a62c5a2874d935aba09c1995d022988ac793609)) +* loading of header reference description ([9248560](https://github.com/microsoft/OpenAPI.NET/commit/9248560d0bac2c3e2d635b653a26d4bfa14e51f4)) +* makes reference serialization object generic ([f0802e5](https://github.com/microsoft/OpenAPI.NET/commit/f0802e5cb1974b6b2d4dc7100b2e3f808ab3538b)) +* parameter reference annoation parsing ([b1578f3](https://github.com/microsoft/OpenAPI.NET/commit/b1578f3fdc8bdbdeab3063ae3d3e6a554800f6d6)) +* path item reference annoations parsing ([d31ed4c](https://github.com/microsoft/OpenAPI.NET/commit/d31ed4c9e0a095eb247de450b3122f0b1dd675d6)) +* removes description field from references that do not support it ([03659f7](https://github.com/microsoft/OpenAPI.NET/commit/03659f7d055e6b339e15ac4434ae4037abb3a546)) +* request body reference annotations parsing ([d9a78dc](https://github.com/microsoft/OpenAPI.NET/commit/d9a78dc5e5433d0f1b628569f4124d4de575cba1)) +* response reference annotations parsing ([e455f52](https://github.com/microsoft/OpenAPI.NET/commit/e455f52f30fdb4937c27132b9596f89f17997663)) +* security scheme reference annoations parsing ([ccc3733](https://github.com/microsoft/OpenAPI.NET/commit/ccc3733a2700d087aac289bb31a6107e9e6d743f)) + +## [2.0.0-preview.23](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.22...v2.0.0-preview.23) (2025-06-03) + + +### Features + +* upgrades OData lib in Hidi to preview15 ([540240a](https://github.com/microsoft/OpenAPI.NET/commit/540240aba9f96b598459cd49b67cd02adc82713d)) +* upgrades OData lib to preview15 ([b300265](https://github.com/microsoft/OpenAPI.NET/commit/b3002652805ff2a36e55531178d4fe579b196c56)) + +## [2.0.0-preview.22](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.21...v2.0.0-preview.22) (2025-06-02) + + +### Features + +* Add writer settings to enable collection sorting using a comparer ([d7eaf47](https://github.com/microsoft/OpenAPI.NET/commit/d7eaf4707c26351cff4e4ec798b64967d9dd932f)) + + +### Bug Fixes + +* rename class; add logic for sorting IEnumerable collections ([58cb4ac](https://github.com/microsoft/OpenAPI.NET/commit/58cb4ac718a840a8dfb5c8821a3c0a484c29befd)) + +## [2.0.0-preview.21](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.20...v2.0.0-preview.21) (2025-05-21) + + +### Bug Fixes + +* do not throw when operation tag is missing matching global tag ([fe133f2](https://github.com/microsoft/OpenAPI.NET/commit/fe133f2604e9b65cc1c7011aab7c62f44e649d19)) +* do not throw when operation tag is missing matching global tag ([2c5aa40](https://github.com/microsoft/OpenAPI.NET/commit/2c5aa40cbb8bf1e96c1ccce6273579e70b69ade2)) + +## [2.0.0-preview.20](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.19...v2.0.0-preview.20) (2025-05-20) + + +### Bug Fixes + +* nullable and type ordering should be maintain to ease up migration work ([6c82aa6](https://github.com/microsoft/OpenAPI.NET/commit/6c82aa6b2d6e4f39af3c594edd8590a0cf749530)) +* nullable should not be inserted as an attempt to normalize the document ([6c82aa6](https://github.com/microsoft/OpenAPI.NET/commit/6c82aa6b2d6e4f39af3c594edd8590a0cf749530)) +* refactor to avoid adding duplicate entries ([41fd508](https://github.com/microsoft/OpenAPI.NET/commit/41fd508074f1b70415026df3aa878cd5f5e7b1ee)) +* refactor to avoid adding duplicate entries ([#2359](https://github.com/microsoft/OpenAPI.NET/issues/2359)) ([9791eb6](https://github.com/microsoft/OpenAPI.NET/commit/9791eb684a0f040feeb8c58701fd4f3577e73e2c)) +* tree node has the wrong structure because of trailing slashes ([2ffb273](https://github.com/microsoft/OpenAPI.NET/commit/2ffb2735aa3718370d6094186142f9cf50b194fa)) +* tree node has the wrong structure because of trailing slashes ([4439340](https://github.com/microsoft/OpenAPI.NET/commit/443934060e1e446de726addde69a2de955b95a7b)) +* wrong link to json schema spec in schema doc comments ([d9b0c90](https://github.com/microsoft/OpenAPI.NET/commit/d9b0c906f7173b81fea15001d588edcbc3eed8f1)) +* wrong link to json schema spec in schema doc comments ([9a73ec6](https://github.com/microsoft/OpenAPI.NET/commit/9a73ec6e5486d84b6a30a5fa0ac5961b381fc3d3)) + +## [2.0.0-preview.19](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.18...v2.0.0-preview.19) (2025-05-16) + + +### Bug Fixes + +* base url should be read from the settings when available ([f5d6e81](https://github.com/microsoft/OpenAPI.NET/commit/f5d6e81c21fd18b6de0fb19b535ad6dbc187790d)) +* base url should be read from the settings when available ([b17b7d8](https://github.com/microsoft/OpenAPI.NET/commit/b17b7d8d25fdf9a767411481287aacee31434aaa)) +* discriminator mapping references don't get a document when created from DOM ([767d3fb](https://github.com/microsoft/OpenAPI.NET/commit/767d3fb163b273b275cd67d710c573c59e4e642b)) +* discriminator mapping references don't get a document when created from DOM ([fdfe002](https://github.com/microsoft/OpenAPI.NET/commit/fdfe002d551fc3feaaeb5af24042826f13bdf412)) + +## [2.0.0-preview.18](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.17...v2.0.0-preview.18) (2025-05-13) + + +### Features + +* upgrades openapi.net.odata and apimanifest to the latest version ([80844a6](https://github.com/microsoft/OpenAPI.NET/commit/80844a60ae50ba0a4d54d7dd2e45ce8360206bf5)) +* upgrades openapi.net.odata and apimanifest to the latest version ([938a2e0](https://github.com/microsoft/OpenAPI.NET/commit/938a2e07b40b082e01ed1cdf3244767cbdca4061)) + + +### Bug Fixes + +* avoid calling virtual members in constructor ([5835057](https://github.com/microsoft/OpenAPI.NET/commit/5835057a7e905e371f859e727ddaf65ec08c6db0)) +* Fix typo in error message ([#2345](https://github.com/microsoft/OpenAPI.NET/issues/2345)) ([3f8b2b9](https://github.com/microsoft/OpenAPI.NET/commit/3f8b2b99c07bd3c58825728c2dd2ffed91d88fbe)) +* handle deserializing and writing empty security requirements [#1426](https://github.com/microsoft/OpenAPI.NET/issues/1426) ([#2323](https://github.com/microsoft/OpenAPI.NET/issues/2323)) ([962e0e4](https://github.com/microsoft/OpenAPI.NET/commit/962e0e436f96b1b68613013d75307dc1f92ce15c)) +* normalized override implementation for parameter types serialization in v2 ([5930916](https://github.com/microsoft/OpenAPI.NET/commit/593091621926defcbc2727a922613e34557d882a)) + +## [2.0.0-preview.17](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.16...v2.0.0-preview.17) (2025-04-16) + + +### Features + +* discriminator mappings now use schema references ([b4877f6](https://github.com/microsoft/OpenAPI.NET/commit/b4877f674ad1a240a367390d40d122eebccc0b20)) +* openapiformat enum cleanup ([#2326](https://github.com/microsoft/OpenAPI.NET/issues/2326)) ([19ffd13](https://github.com/microsoft/OpenAPI.NET/commit/19ffd136a7d2137f3de0896148d9a39f469ac711)) +* Remove default collection initialization for perf reasons ([#2284](https://github.com/microsoft/OpenAPI.NET/issues/2284)) ([3604382](https://github.com/microsoft/OpenAPI.NET/commit/36043829d29340a47fc93c6477a38ea93e59ef57)) + + +### Bug Fixes + +* Empty tag causes error generating Kiota client [#2283](https://github.com/microsoft/OpenAPI.NET/issues/2283) ([#2286](https://github.com/microsoft/OpenAPI.NET/issues/2286)) ([521d636](https://github.com/microsoft/OpenAPI.NET/commit/521d636e2c437c25e1758e9f6a22793d74adf2d7)) +* hidi fails to parse yaml files when fixing references ([a5c4d61](https://github.com/microsoft/OpenAPI.NET/commit/a5c4d6109c433b949cdb1665c00ad778b82b28b0)) +* hidi fails to parse yaml files when fixing references ([c5b69fe](https://github.com/microsoft/OpenAPI.NET/commit/c5b69fed9c413a6399c36e0f543e1019faac77e6)) +* Improve handling of OpenAPI tag references ([#2325](https://github.com/microsoft/OpenAPI.NET/issues/2325)) ([bf9954a](https://github.com/microsoft/OpenAPI.NET/commit/bf9954a257691231fac6f56667bde208a98a5b42)) +* read (Exclusive)Maximum and (Exclusive)Minimum values as strings and write their raw values during serialization ([#2309](https://github.com/microsoft/OpenAPI.NET/issues/2309)) ([ac66756](https://github.com/microsoft/OpenAPI.NET/commit/ac667560a951bef2824851c208c55ba070e96163)) +* relative references in subdirectory documents are not loading [#1674](https://github.com/microsoft/OpenAPI.NET/issues/1674) ([#2243](https://github.com/microsoft/OpenAPI.NET/issues/2243)) ([4bcbd51](https://github.com/microsoft/OpenAPI.NET/commit/4bcbd51caff689a73e90efbc08f683383741e004)) +* renames annotations schema property to metadata to match [#2241](https://github.com/microsoft/OpenAPI.NET/issues/2241) ([28e4a75](https://github.com/microsoft/OpenAPI.NET/commit/28e4a7590fb3525e30970112191d72eaf048ad6b)) +* renames annotations schema property to metadata to match [#2241](https://github.com/microsoft/OpenAPI.NET/issues/2241) ([33fc7cb](https://github.com/microsoft/OpenAPI.NET/commit/33fc7cbcda71efea47070ab7a6ebf9db8787a7f8)) +* set format to binary for file uploads ([#2305](https://github.com/microsoft/OpenAPI.NET/issues/2305)) ([47f10d3](https://github.com/microsoft/OpenAPI.NET/commit/47f10d323e78b9e6caa757c0d2efa378a19fc28c)) + +## [2.0.0-preview.16](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.15...v2.0.0-preview.16) (2025-03-20) + + +### Bug Fixes + +* always serialize security schemes in components ([3aac661](https://github.com/microsoft/OpenAPI.NET/commit/3aac661ca2e8050136c423f2835fcdd3a9096482)) +* always serialize security schemes in components ([a765acf](https://github.com/microsoft/OpenAPI.NET/commit/a765acf380135694bbd4d1336bd4beddef6ef808)) + +## [2.0.0-preview.15](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.14...v2.0.0-preview.15) (2025-03-18) + + +### Bug Fixes + +* Include hidi in solution ([7f4bec8](https://github.com/microsoft/OpenAPI.NET/commit/7f4bec8304771b498e8b0e33c706869ff79fd155)) +* remove duplicate unused property ([f62e039](https://github.com/microsoft/OpenAPI.NET/commit/f62e039a2efde04d0c3988b359ca09ab3349a40b)) +* revert change to exclude hidi in solution ([c3afe4e](https://github.com/microsoft/OpenAPI.NET/commit/c3afe4e8af2526e957940503a31079ed5f027c0a)) + +## [2.0.0-preview.14](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.13...v2.0.0-preview.14) (2025-03-18) + + +### Bug Fixes + +* exclude hidi from release due to package source mapping conflict ([72daa54](https://github.com/microsoft/OpenAPI.NET/commit/72daa544f2bfe8d51ed69d7ba82d31cbc36580f2)) + +## [2.0.0-preview.13](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.12...v2.0.0-preview.13) (2025-03-14) + + +### Features + +* adds OpenApiDocument.SerializeAs() so simplify serialization scenarios ([371a574](https://github.com/microsoft/OpenAPI.NET/commit/371a57405b013bdc257a51cc831f7487d1749823)) +* enable null reference type support ([#2146](https://github.com/microsoft/OpenAPI.NET/issues/2146)) ([96574ec](https://github.com/microsoft/OpenAPI.NET/commit/96574ecc46dca647a708b6673c7e5309824eda2f)) +* enables references as components ([eeffba9](https://github.com/microsoft/OpenAPI.NET/commit/eeffba9d50a53a3be1630d01edd8d0b57a966dee)) +* use http method object instead of enum ([8baff28](https://github.com/microsoft/OpenAPI.NET/commit/8baff287aa9450ad3bd467816de321e30157bcb3)) + + +### Bug Fixes + +* a bug where references would not serialize summary or descriptions in 3.1 ([ca7ccdd](https://github.com/microsoft/OpenAPI.NET/commit/ca7ccdd933b57c2775d0295e22e541c2904b5fb7)) +* handling for reference IDs with http prefix ([3385a0e](https://github.com/microsoft/OpenAPI.NET/commit/3385a0e0088c44fb926affcb20f166a02391427c)) + +## [2.0.0-preview.12](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview.11...v2.0.0-preview.12) (2025-03-07) + + +### Bug Fixes + +* fixes serialization of openApidocs with operation tags with settings to inline references ([8eecae6](https://github.com/microsoft/OpenAPI.NET/commit/8eecae6183f594c5508fc2c74d395c6030ce8727)) +* fixes serialization of openApidocs with operation tags with settings to inline references. ([f67fe64](https://github.com/microsoft/OpenAPI.NET/commit/f67fe64e669a3f8518d89b007150c3e1bdb69fd1)) + +## [2.0.0-preview.11](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview10...v2.0.0-preview.11) (2025-03-03) + + +### Bug Fixes + +* rename `OpenApiDocument.SecurityRequirements` as `Security` ([d8553d6](https://github.com/microsoft/OpenAPI.NET/commit/d8553d6e007c1fa38bb982c9eb757678e789111b)) + + +### Miscellaneous Chores + +* release 2.0.0-preview.11 ([f425b8e](https://github.com/microsoft/OpenAPI.NET/commit/f425b8ed48ce5e488f85ad3060e6c43734274250)) + +## [2.0.0-preview10](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview9...v2.0.0-preview10) (2025-02-27) + + +### Features + +* deduplicates tags at the document level ([93c468e](https://github.com/microsoft/OpenAPI.NET/commit/93c468ebd9ee30b0cb32a583821d8abe3d017b18)) +* tags references are now deduplicated as well ([763c0c1](https://github.com/microsoft/OpenAPI.NET/commit/763c0c1c5856a0ed56128b0ab8ce4b3a29ed193a)) + + +### Bug Fixes + +* add logic for serializing date time objects ([23395c5](https://github.com/microsoft/OpenAPI.NET/commit/23395c5776a781f64a7dc7bfd2867ca83eaa0bb7)) +* adds missing cancellation parameter to async method ([243a111](https://github.com/microsoft/OpenAPI.NET/commit/243a111c19f2939b0a5d27c21db302f8349049eb)) +* avoid creating new http clients to load additional documents of the workspace ([0f23798](https://github.com/microsoft/OpenAPI.NET/commit/0f23798f61ac964f9e71ef7402213392ebe91151)) +* deduplicates exclusive min/max properties in the object model ([08414a1](https://github.com/microsoft/OpenAPI.NET/commit/08414a16db5e0a627c953f107aa34501c18996bb)) +* deduplicates exclusive min/max properties in the object model ([0d5b471](https://github.com/microsoft/OpenAPI.NET/commit/0d5b4716d8cf0215257680d6cbaddaa84438eac5)) +* moves the http client for the reader to settings so it can be passed by client application ([9b910f3](https://github.com/microsoft/OpenAPI.NET/commit/9b910f3928ebcb24560ff004a58e5d397ed3d836)) +* OpenAPIDocument JsonSchemaDialect property is now a URI ([45977b5](https://github.com/microsoft/OpenAPI.NET/commit/45977b50188a0065fde02a3ac44a1fe718a85b30)) +* openapischema schema property is now a Uri ([452a6b9](https://github.com/microsoft/OpenAPI.NET/commit/452a6b9730a2fa310aee64d0b9d2a0c7ea6d131f)) +* primitive parsing for strings as DateTimes is too greedy ([4ee1d8b](https://github.com/microsoft/OpenAPI.NET/commit/4ee1d8bf44b5fcdf0fd22deca1d36ee4faf421d1)) +* removes static readers registry ([fe7a2fd](https://github.com/microsoft/OpenAPI.NET/commit/fe7a2fd654e93ce99dd0ebd628042f816c787104)) +* use a single http client in hidi ([9386fae](https://github.com/microsoft/OpenAPI.NET/commit/9386faec70655279ec3a031fd2afcd9cab09af40)) + +## [2.0.0-preview9](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview8...v2.0.0-preview9) (2025-02-21) + + +### Features + +* add support for dependentRequired ([75d7a66](https://github.com/microsoft/OpenAPI.NET/commit/75d7a662fc873566e50191127e4082b4ecf5ca7a)) + + +### Bug Fixes + +* an issue where deprecation extension parsing would fail ([5db8757](https://github.com/microsoft/OpenAPI.NET/commit/5db8757df642dbe651552ce4a7c740e94474eafc)) +* an issue where deprecation extension parsing would fail ([b59864c](https://github.com/microsoft/OpenAPI.NET/commit/b59864c2387c9410e71b0caa8d439e7f122ddc24)) +* refactor ToIdentifier() to normalize flaggable enums ([#2156](https://github.com/microsoft/OpenAPI.NET/issues/2156)) ([b80e934](https://github.com/microsoft/OpenAPI.NET/commit/b80e9342018cf136cc54b900bb95832a6867e982)) + +## [2.0.0-preview8](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview7...v2.0.0-preview8) (2025-02-17) + + +### Bug Fixes + +* a bug where external reference loading for local files would not work on linux ([df99a00](https://github.com/microsoft/OpenAPI.NET/commit/df99a00010001b35b34f9b74bbf12437f90b6b18)) +* add meaningful exception message during validation ([4a6547d](https://github.com/microsoft/OpenAPI.NET/commit/4a6547d08c86194e1783ce7f52e8248ca15556e0)) +* add meaningful exception message during validation ([74d20ed](https://github.com/microsoft/OpenAPI.NET/commit/74d20edebb6c5ee6150e8e03a42a40ed8c01d1da)) +* adds a cancellation token argument to external document loading ([a5ffab1](https://github.com/microsoft/OpenAPI.NET/commit/a5ffab1e77c19987fe468b9297e19e8f4c48f47a)) +* parsing failure on nodes set to null ([20aacc1](https://github.com/microsoft/OpenAPI.NET/commit/20aacc1a21510dbfe8cb21fb6ec2fc8b7720f2aa)) +* parsing failure on nodes set to null ([4245de9](https://github.com/microsoft/OpenAPI.NET/commit/4245de9ff333a1d34e125ba72c543b6e78db6980)) + +## [2.0.0-preview7](https://github.com/microsoft/OpenAPI.NET/compare/v2.0.0-preview6...v2.0.0-preview7) (2025-02-06) + + +### Bug Fixes + +* do not write null for types on parameters in v2 ([f889937](https://github.com/microsoft/OpenAPI.NET/commit/f8899379d34054e919c670ab2f8dca876bc418d5)) +* do not write null for types on parameters in v2 ([4aef7b7](https://github.com/microsoft/OpenAPI.NET/commit/4aef7b7aa4d6f19be86f7bdaf1c37edb7d174317)) + +## [2.0.0-preview6](https://github.com/microsoft/openapi.net/compare/2.0.0-preview5...v2.0.0-preview6) (2025-02-05) + + +### Features + +* adds a net8 target to benefit from all the conditional compilation ([a201aa2](https://github.com/microsoft/openapi.net/commit/a201aa237c39ab6748db0bfebd7d8c7be7ce4530)) +* adds components registration method for schemas ([10e548a](https://github.com/microsoft/openapi.net/commit/10e548ac943d6e87b132a2fcd3784c21d320346d)) +* adds deconstructor to read result ([79336f6](https://github.com/microsoft/openapi.net/commit/79336f6b1432c33f612cfc5c8ac9c79abdc04659)) +* adds deconstructor to read result ([d8c1593](https://github.com/microsoft/openapi.net/commit/d8c159331c230154236faafc315d008c61f3eb7b)) +* adds to identifier mapping to non nullable enum ([bd9622e](https://github.com/microsoft/openapi.net/commit/bd9622e239d5a5b2b4629d2f371f674775193af5)) +* bumps target OAS version to 3.1.1 ([9e8d8a4](https://github.com/microsoft/openapi.net/commit/9e8d8a4f46a6ae79d8bb53e18ff6e9d159388893)) +* configure AOT for trimming compatibility ([b4f9c3e](https://github.com/microsoft/openapi.net/commit/b4f9c3edc62e67b588e0acc04ea843f1a3bf0a76)) +* makes document optional ([754f763](https://github.com/microsoft/openapi.net/commit/754f763c2b148c04f0ba11b9c8e948557cc91b14)) +* makes the reference interface covariant ([7405f3c](https://github.com/microsoft/openapi.net/commit/7405f3c0c2d48b9b124a28796c3a7e9bce909aa7)) +* splits described and summarized interfaces ([2a10cd9](https://github.com/microsoft/openapi.net/commit/2a10cd95d254001c397a7cd28568e468800e6644)) + + +### Bug Fixes + +* 3.0 serialization when type is set to null ([920a51a](https://github.com/microsoft/openapi.net/commit/920a51a9170eb76921fd0e6529461e7681ac4c19)) +* a bug where 3.0 downcast of type null would not work ([6b636d5](https://github.com/microsoft/openapi.net/commit/6b636d53a7842e3eaf5fa70a91bc27c72be14e47)) +* a bug where 3.0 downcast of type null would not work ([ac05342](https://github.com/microsoft/openapi.net/commit/ac05342befbe51944cf3a1c966d564077e8e28ea)) +* a flaky behaviour for format property serialization ([3ea1fa9](https://github.com/microsoft/openapi.net/commit/3ea1fa981ec4d94909358e1c70c0904a2e3c4269)) +* a flaky behaviour for format property serialization ([52981d4](https://github.com/microsoft/openapi.net/commit/52981d4cebf4831f94dd59968231740e7891c5a3)) +* additional 3.1.0 constants after merge and v2 release ([9e8d8a4](https://github.com/microsoft/openapi.net/commit/9e8d8a4f46a6ae79d8bb53e18ff6e9d159388893)) +* adds generic shallow copy method to avoid inadvertent conversions of references to schemas ([e4c14a4](https://github.com/microsoft/openapi.net/commit/e4c14a451d9d50bcae0cf9b74162033cb2954a72)) +* adds missing culture argument to date serialization ([45329e4](https://github.com/microsoft/openapi.net/commit/45329e4e5b3606964e85bbfdece4b5f239865353)) +* adds missing null prop operator to proxy properties ([8361069](https://github.com/microsoft/openapi.net/commit/83610696a0c026071308d7247fab914f4db72190)) +* adds missing null propagation operators for callback and header references ([0cb4ccb](https://github.com/microsoft/openapi.net/commit/0cb4ccb925ab54e15351cbf2b0f4ae58c6b866c8)) +* adds support for all component types ([8a73b54](https://github.com/microsoft/openapi.net/commit/8a73b540e88bd18aeef27e86e41dbec3e7e1d2cd)) +* aligns callback parameter name with interface ([68b25cc](https://github.com/microsoft/openapi.net/commit/68b25cc5cc9ffd809a45ce532200ce3262f39ad2)) +* aligns missing properties for override ([e3325b9](https://github.com/microsoft/openapi.net/commit/e3325b9d4cedee6a9734899906e938888f023506)) +* aligns parameter name with interface definition for example ([d7e1f91](https://github.com/microsoft/openapi.net/commit/d7e1f919ee61e7cd4596f216890e16c7719e99c9)) +* aligns reference copy constructors ([ce93aa7](https://github.com/microsoft/openapi.net/commit/ce93aa7a23280b1fb60b9bc4e5ca4a070414fb0c)) +* aligns to null propagation operator ([8d57b81](https://github.com/microsoft/openapi.net/commit/8d57b81d7122c9ffad4f1c348879cc6df971617c)) +* allow registration of component references ([14750dc](https://github.com/microsoft/openapi.net/commit/14750dcabe29805479c3fed10152dee1ac4111af)) +* an empty security requirement should not result in an object during serialization ([1c6fd8e](https://github.com/microsoft/openapi.net/commit/1c6fd8e8ff38d0259af7fbd9903f361ecfb19225)) +* build passes ([ea68427](https://github.com/microsoft/openapi.net/commit/ea68427110e5f789019b46885ea45f8f6b975c53)) +* callback reference proxy implementation ([028d60b](https://github.com/microsoft/openapi.net/commit/028d60bd4003f54f6f130e56400cd7533951e1f2)) +* callback reference proxy implementation ([2cbb0fa](https://github.com/microsoft/openapi.net/commit/2cbb0fa352ecaf09014f26ab5fddc8ca89e63c2c)) +* components schema copy ([88daad5](https://github.com/microsoft/openapi.net/commit/88daad5d31fee2f4826be9717ece808495d9b4d8)) +* conditional version for extension causes invalid json ([4030c1f](https://github.com/microsoft/openapi.net/commit/4030c1fda6a04006326e76c8a2ca7ffd98e2d1d6)) +* conditional version for extension causes invalid json ([0ce92cc](https://github.com/microsoft/openapi.net/commit/0ce92cc948869e0d5eb46d388559405c9b412b06)) +* date time and date time offset shifting zones ([a6a44a7](https://github.com/microsoft/openapi.net/commit/a6a44a7e3d271a2cc88fda02aabec944402a32a9)) +* default settings in case of null value ([ab2ddf0](https://github.com/microsoft/openapi.net/commit/ab2ddf0f264ccaf6efbf127c23be00adec51be1f)) +* do not allow null argument for example copy constructor ([aa80b19](https://github.com/microsoft/openapi.net/commit/aa80b1968d9ec6ad26f8b45578040026883d5890)) +* do not copy host document as it negatively impact performance ([1043e4e](https://github.com/microsoft/openapi.net/commit/1043e4e3d2fbe4bf84aae453c5d76ce5672f64b6)) +* do not copy host document as it negatively impact performance ([a46e857](https://github.com/microsoft/openapi.net/commit/a46e8578519c85b9455e41ccbeebeb8740252ae3)) +* do not emit a type array in 3.1 when unnecessary ([3b3d0e6](https://github.com/microsoft/openapi.net/commit/3b3d0e6da51f7958285b8aa5be5d1eb73ec69acd)) +* draft security scheme reference proxy design pattern ([1bd2624](https://github.com/microsoft/openapi.net/commit/1bd2624dcb6751c9f31ecec422d5ec9852370397)) +* empty security requirements are actually valid. to negate the document ones ([42bd396](https://github.com/microsoft/openapi.net/commit/42bd3960d799af3d522ba122ce713a7d418c98ba)) +* enum description number values ([ff7b4a9](https://github.com/microsoft/openapi.net/commit/ff7b4a99351661b7dd26e24bd4daa9e61d39ff27)) +* enum description number values ([e29e24c](https://github.com/microsoft/openapi.net/commit/e29e24c58f51af4f6a39aeb65041dbd7f7ab888f)) +* enum parsing when encountering unknown values should not default to first member ([d4e155b](https://github.com/microsoft/openapi.net/commit/d4e155b6d66887f28cbb13fb22ba0d70eabc4139)) +* enum parsing when encountering unknown values should not default to first member ([9d07ebb](https://github.com/microsoft/openapi.net/commit/9d07ebb4b70bdd641748270a831df031d35b7ec4)) +* extensions collection initialization ([4f28b65](https://github.com/microsoft/openapi.net/commit/4f28b657310b90c82a5b5af9f91ef6e097847a97)) +* extraneous null prop removal ([1006879](https://github.com/microsoft/openapi.net/commit/10068797577e14ed4ebf6909face0aef7e3f7d56)) +* failing unit test after merge ([a4ac872](https://github.com/microsoft/openapi.net/commit/a4ac872c3336fad2f6a4e05a7602ea76f6db9b49)) +* failing unit tests for security scheme references in security requirements ([d2e4111](https://github.com/microsoft/openapi.net/commit/d2e4111198a435547bacfe62a5626e4d78114f8d)) +* fixes inlining override when they should not happen ([704943c](https://github.com/microsoft/openapi.net/commit/704943c28f87257e896d1a79eb6962d60f719bec)) +* fixes invalid OAI document for unit tests ([837f000](https://github.com/microsoft/openapi.net/commit/837f00081a1e52200b90adeac6e2aff32c92d296)) +* inconsistant API surface usage ([47ad76b](https://github.com/microsoft/openapi.net/commit/47ad76b4318d1a468478d4c1c82092bd5aa0eb6a)) +* last reference to copy constructor ([d87375d](https://github.com/microsoft/openapi.net/commit/d87375dc8d463fb348938acb1ed048b5a5dde166)) +* makes reference fields immutable ([fda05d4](https://github.com/microsoft/openapi.net/commit/fda05d465ef84f2c4c755aca2252e2672ad40107)) +* makes reference of holder immutable ([a182f44](https://github.com/microsoft/openapi.net/commit/a182f44bfb74ccbbb5b4bbf842693de48d60dac1)) +* makes target field read only ([89881fd](https://github.com/microsoft/openapi.net/commit/89881fd5fa28148969eba75fad07ac26d4fb4e3d)) +* missing defensive programming in copy constructors ([227d99d](https://github.com/microsoft/openapi.net/commit/227d99d23557fab82fcb7eb7d6e8fa34b486719d)) +* missing doc comment for annotations ([41759a1](https://github.com/microsoft/openapi.net/commit/41759a1cb587d38392f730dfce74e974c76189c6)) +* missing null prop operator on parameter reference ([019eb99](https://github.com/microsoft/openapi.net/commit/019eb99fc26f323f7a5bc79609954d237b1c0bfc)) +* missing property rename ([2443fa0](https://github.com/microsoft/openapi.net/commit/2443fa0d3da5ec4ef09d9e6cae2491a117fac77b)) +* multiple performance fixes for type serialization ([bd9622e](https://github.com/microsoft/openapi.net/commit/bd9622e239d5a5b2b4629d2f371f674775193af5)) +* multiple performance fixes for type serialization feat: adds to identifier mapping to non nullable enum ([5fef51c](https://github.com/microsoft/openapi.net/commit/5fef51c4cb3685eceabfdbb21abb1e88a87571a9)) +* multiple unit test failures ([2f171a3](https://github.com/microsoft/openapi.net/commit/2f171a3476ea0f3227ecdcb724f1d1af5406ec0e)) +* null flag comparison ([081e251](https://github.com/microsoft/openapi.net/commit/081e2511b9df964ad74f7cb0e48761977e50cc45)) +* null propagation for most failed reference lookup ([7994691](https://github.com/microsoft/openapi.net/commit/7994691db279c23e3ac120a54b5d96cc7f88ae3f)) +* null reference check ([a5023d6](https://github.com/microsoft/openapi.net/commit/a5023d659b7adaedbe18853c297e78ac12e22823)) +* Open API header proxy design pattern implementation ([77e0ad1](https://github.com/microsoft/openapi.net/commit/77e0ad10ca213c449523e9ff1802da6a6bd800e2)) +* open API link reference proxy design pattern implementation ([6a96462](https://github.com/microsoft/openapi.net/commit/6a9646278377d0f81289c34ad25b2102b488dd9e)) +* open API link reference proxy design pattern implementation ([376e54d](https://github.com/microsoft/openapi.net/commit/376e54de6d419c4e6673111538140bedafd7896e)) +* open api response reference should not clone objects ([4243873](https://github.com/microsoft/openapi.net/commit/42438730a57acada699a017da41838d0d54e141d)) +* open api schema reference proxy design pattern implementation ([e57d049](https://github.com/microsoft/openapi.net/commit/e57d04972c360f1367583eb9e60f750f8882f0b7)) +* open api schema reference proxy design pattern implementation ([aebefb7](https://github.com/microsoft/openapi.net/commit/aebefb76094e71718b1d60691e9ac12a95a25283)) +* parameter reference proxy design pattern implementation ([ed6ffa1](https://github.com/microsoft/openapi.net/commit/ed6ffa1d4a59857cc57f6286d383ff3a9661a00e)) +* parameter reference proxy design pattern implementation ([eeb79a4](https://github.com/microsoft/openapi.net/commit/eeb79a4a7700d6fb56fbcbbe6913d224fa126167)) +* passes missing host document references to all layers ([d7c4621](https://github.com/microsoft/openapi.net/commit/d7c462163272a26705f9b30f2a6c407c74acfc0f)) +* passes missing host document references to all layers ([ff1406c](https://github.com/microsoft/openapi.net/commit/ff1406c60082727851d22003211faaa4e876d2e8)) +* path item reference implementation ([56f291b](https://github.com/microsoft/openapi.net/commit/56f291b325682e72f1f347097be2fb9786c628b1)) +* path item reference implementation ([c725267](https://github.com/microsoft/openapi.net/commit/c7252677814eec7a9a8ff6f0f3a51f5e113f5f19)) +* potential NRT ([9db6e2d](https://github.com/microsoft/openapi.net/commit/9db6e2d3ce9043ff6b702060eda75290aa37b401)) +* potential NRT for net8 build ([f517deb](https://github.com/microsoft/openapi.net/commit/f517deb6c7f68947a4a25da5b76ed1ee94d307e2)) +* proxy design pattern implementation for OpenAPiExample ([cc28ff2](https://github.com/microsoft/openapi.net/commit/cc28ff27446dae0fc0e9f9f44dafd6df6e8fc243)) +* proxy design pattern implementation for request body ([425335e](https://github.com/microsoft/openapi.net/commit/425335eb46d4a48104046af62265ba0ca6a1ec7b)) +* references callback writer ([88ad997](https://github.com/microsoft/openapi.net/commit/88ad99759d8735824c7a70321ed7efc164633f06)) +* removes all obsolete APIs ([e861c08](https://github.com/microsoft/openapi.net/commit/e861c08442fe7b2f1b0e4079d4a007e525a75ca9)) +* removes extraneuous null prop op in copy constructor ([227d99d](https://github.com/microsoft/openapi.net/commit/227d99d23557fab82fcb7eb7d6e8fa34b486719d)) +* removes nullable property that shouldn't be part of dom ([4d9c17b](https://github.com/microsoft/openapi.net/commit/4d9c17b7287b27b9058828765722f55eb378e40a)) +* removes redundant assignment ([8d70195](https://github.com/microsoft/openapi.net/commit/8d701955f24801b495dfd4b3b7a2351b499355b2)) +* removes unnecessary null prop in copy constructor ([aa993b1](https://github.com/microsoft/openapi.net/commit/aa993b10ff72fb18f7dc3f49d87586662188a381)) +* removes unused parameters ([de9d979](https://github.com/microsoft/openapi.net/commit/de9d979ec3f53fb7a86c43309f7e87d20d89d22a)) +* removes unused parameters ([9cd7aae](https://github.com/microsoft/openapi.net/commit/9cd7aaea76316b3944e8a549db9aad3a3155b51b)) +* removes useless condition for null check ([4a50c77](https://github.com/microsoft/openapi.net/commit/4a50c77a90f0e9810b4912cbb694883921c508cd)) +* removes useless virtual definitions in components ([af3038a](https://github.com/microsoft/openapi.net/commit/af3038a0fcee46c4806382fe061e4f2e7059fdbe)) +* removes virtual modifier in MediaType ([4dfc9b8](https://github.com/microsoft/openapi.net/commit/4dfc9b8c533d454cefa3d576adb4d3d422747d16)) +* request body references are converted to v2 properly ([b84ea19](https://github.com/microsoft/openapi.net/commit/b84ea194a16e03a1f2b6f56af892eb6288d5627a)) +* response reference proxy design pattern implementation ([8103c20](https://github.com/microsoft/openapi.net/commit/8103c20f669eb9c127aec3baaaafda3987381d9b)) +* response reference proxy design pattern implementation ([5b4003b](https://github.com/microsoft/openapi.net/commit/5b4003bd04d59fd460280fa06e6151b0203680cb)) +* restores default constructor for ISerializable implementation ([778184f](https://github.com/microsoft/openapi.net/commit/778184ff608cd4172de689684272b2d7a8627339)) +* returns reference instead of null ([45e40fa](https://github.com/microsoft/openapi.net/commit/45e40fa675570fc382d4a72684a009b567d45118)) +* sets hidi version to a preview ([975b1bf](https://github.com/microsoft/openapi.net/commit/975b1bfa563bc36ad8031de934af158cb807bca8)) +* sets hidi version to a preview ([8999336](https://github.com/microsoft/openapi.net/commit/899933636f15991add45e367befd1c30c93bcf2c)) +* shallow copy for callback ([4ea87ef](https://github.com/microsoft/openapi.net/commit/4ea87efad0edde89f2e29c0c495a33a4467ba939)) +* shallow copy for example ([9bc3044](https://github.com/microsoft/openapi.net/commit/9bc30443ab95fd05b0b328c13b7e36e911628dda)) +* shallow copy for parameter link path item and request body ([9af6f30](https://github.com/microsoft/openapi.net/commit/9af6f30719c7e0718798df98096f1679f74c20e7)) +* side effects in tag references ([717deb0](https://github.com/microsoft/openapi.net/commit/717deb08d2198519a69a3ccf701f46dac229e608)) +* side effects in tag references ([878593b](https://github.com/microsoft/openapi.net/commit/878593b7a7e6ff1f2adc6965608c46e5f8ce8f38)) +* single copy and maintain for references ([30ee6ed](https://github.com/microsoft/openapi.net/commit/30ee6ed9ac8e6a6a7d1931bed9da22e0116ec9af)) +* specifies encoding for net fx ([95dafe6](https://github.com/microsoft/openapi.net/commit/95dafe60a103293acba6c6aa16c4c780e7b576c9)) +* specifies encoding for net fx ([cd13481](https://github.com/microsoft/openapi.net/commit/cd13481f4e3a883186d10b3af63cbd928a17c8ba)) +* support non-standard MIME type in response header ([50ddca2](https://github.com/microsoft/openapi.net/commit/50ddca2f72a9b4eef21c45fdd1c978e8f6f32eb3)) +* switches header to shallow copy ([2a42c36](https://github.com/microsoft/openapi.net/commit/2a42c36eb7d83c0b83f8263b7989f84c5ddf911d)) +* tag reference proxy design pattern implementation ([46e08d4](https://github.com/microsoft/openapi.net/commit/46e08d4b53e756db5d717337488c9bb787ec8ee7)) +* tag, response, and security scheme shallow copy ([7ac149c](https://github.com/microsoft/openapi.net/commit/7ac149c70d69c357aa0dc0d8e29e975a886226f9)) +* updates public api file ([b727581](https://github.com/microsoft/openapi.net/commit/b727581d6fd1d814b5c1887400cb48f06dd96362)) +* updates public API surface with net8 target ([1a1e013](https://github.com/microsoft/openapi.net/commit/1a1e0135e977440be91e64d14e3d2b094238facd)) +* uses backing fields instead of schema copy ([6f4e7a2](https://github.com/microsoft/openapi.net/commit/6f4e7a245376cb816367ff86c497cbba023b6faf)) +* uses the json node clone API to avoid unecessary allocs ([818414d](https://github.com/microsoft/openapi.net/commit/818414d73a351447a403e8555c140b180de5d375)) +* v2 references for properties do not work as expected ([aa90edf](https://github.com/microsoft/openapi.net/commit/aa90edf1b624e1bd2381700f2d8b659507bf0119)) +* v2 references for properties do not work as expected ([ec9c01b](https://github.com/microsoft/openapi.net/commit/ec9c01b9b873d02ab2682ceb5fb9ac509a931781)) +* v2 request body content null propagation ([6d064c4](https://github.com/microsoft/openapi.net/commit/6d064c4b967f7f9262a85438d27cf7bf2ccc412c)) +* v2 request body content null propagation ([8b4833c](https://github.com/microsoft/openapi.net/commit/8b4833cce98cb8d8c782ceed8d5d122357b71065)) +* visibility of serialize internal methods ([dc8a757](https://github.com/microsoft/openapi.net/commit/dc8a7572ec436c1ed35f5a6208c6aa868702dc0f)) + + +### Performance Improvements + +* avoid round trip serialization ([a6a44a7](https://github.com/microsoft/openapi.net/commit/a6a44a7e3d271a2cc88fda02aabec944402a32a9)) + +## Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..686e5e7a0 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,10 @@ +# Microsoft Open Source Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). + +Resources: + +- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) +- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns +- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..195723567 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contributing to OpenAPI.net + +OpenAPI.net is a mono-repo containing source code for the following packages: + +## Libraries + +| Library | NuGet Release | +|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Microsoft.OpenAPI](./src/Microsoft.OpenAPI/README.md) | [![NuGet Version](https://img.shields.io/nuget/vpre/Microsoft.OpenAPI?label=Latest&logo=nuget)](https://www.nuget.org/packages/Microsoft.OpenAPI/) | +| [Microsoft.OpenAPI.YamlReader](./src/Microsoft.OpenApi.YamlReader/README.md) | [![NuGet Version](https://img.shields.io/nuget/vpre/Microsoft.OpenAPI.YamlReader?label=Latest&logo=nuget)](https://www.nuget.org/packages/Microsoft.OpenAPI.YamlReader/) | +| [Microsoft.OpenAPI.Hidi](./src/Microsoft.OpenAPI.Hidi/README.md) | [![NuGet Version](https://img.shields.io/nuget/vpre/Microsoft.OpenAPI.Hidi?label=Latest&logo=nuget)](https://www.nuget.org/packages/Microsoft.OpenAPI.Hidi/) | + +OpenAPI.net is open to contributions. There are a couple of different recommended paths to get contributions into the released version of this library. + +__NOTE__ A signed a contribution license agreement is required for all contributions, and is checked automatically on new pull requests. Please read and sign [the agreement](https://cla.microsoft.com/) before starting any work for this repository. + +## File issues + +The best way to get started with a contribution is to start a dialog with the owners of this repository. Sometimes features will be under development or out of scope for this SDK and it's best to check before starting work on contribution. Discussions on bugs and potential fixes could point you to the write change to make. + +## Submit pull requests for bug fixes and features + +Feel free to submit a pull request with a linked issue. + +### Branches and support policy + +Because one major consumer of these libraries is ASP.net, the support policy of this repository is aligned with [dotnet support policy](https://dotnet.microsoft.com/platform/support/policy/dotnet-core#lifecycle). + +The following table outlines the mapping between package major versions, dotnet versions, and which contributions are accepted. As a consumer, make sure the version of this library your application is using is aligned with the version of ASP.net described in the table below. + +| Major version | Branch | Supported [AspNetCore OpenAPI versions](https://www.nuget.org/packages/Microsoft.AspNetCore.OpenApi) | Supported [Swashbuckle.AspNetCore version](https://www.nuget.org/packages/Swashbuckle.AspNetCore/) | Supported OpenAPI versions | Changes provided by Microsoft | Accepted contributions | End of support date | +| ------------- | ---------- | -------------------------- | ---------- | -------------------------- | ------------------------------------------- | ------------------------------------------- | --------------- | +| 1.X | support/v1 | < 10 | < 10 | 2.0, 3.0 | security fixes | security and bugfixes | .NET 9 (Nov 2026) | +| 2.X | support/v2 | = 10 ¹ | = 10 ³ | 2.0, 3.0, 3.1 | security and bugfixes | security and bugfixes | .NET 10 (Nov 2028) ¹ | +| 3.X ² | main | not available | not available | 2.0, 3.0, 3.1, 3.2 | security, bugfixes and feature improvements | security, bugfixes and feature improvements | TBD | + +> Notes: +> +> 1. This assumes that AspNetCore OpenAPI version 11 and above will adopt version 3 or above of this library, otherwise, it'd expand the support date for version 2 of this library. +> 2. This will be conditioned by new releases of OpenAPI, this library, ASP.NET and AspNetCore OpenAPI's adoption of new versions of this library. +> 3. This assumes that Swashbuckle.AspNetCore version 11 and above will adopt version 3 or above of this library. + +### Multi-versions requirement for contributions + +When contributing to the library, start by making a contribution to the main branch first, or the uppermost version it applies to. During the review process you'll be asked to demonstrate your contribution cannot apply to prior versions or to port your contribution to the branches for prior versions before the initial pull request can get merged. + +This approach helps maintain a similar behavior across all versions under active support. + +## Commit message format + +To support our automated release process, pull requests are required to follow the [Conventional Commit](https://www.conventionalcommits.org/en/v1.0.0/) +format. +Each commit message consists of a __header__, an optional __body__ and an optional __footer__. The header is the first line of the commit and +MUST have a __type__ (see below for a list of types) and a __description__. An optional __scope__ can be added to the header to give extra context. + +``` +[optional scope]: + + + + +``` + +The recommended commit types used are: + +- __feat__ for feature updates (increments the _minor_ version) +- __fix__ for bug fixes (increments the _patch_ version) +- __perf__ for performance related changes e.g. optimizing an algorithm +- __refactor__ for code refactoring changes +- __test__ for test suite updates e.g. adding a test or fixing a test +- __style__ for changes that don't affect the meaning of code. e.g. formatting changes +- __docs__ for documentation updates e.g. ReadMe update or code documentation updates +- __build__ for build system changes (gradle updates, external dependency updates) +- __ci__ for CI configuration file changes e.g. updating a pipeline +- __chore__ for miscallaneous non-sdk changesin the repo e.g. removing an unused file + +Adding an exclamation mark after the commit type (`feat!`) or footer with the prefix __BREAKING CHANGE:__ will cause an increment of the _major_ version. \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 000000000..c1b6e63d1 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,24 @@ + + + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + Microsoft + Microsoft + MIT + true + https://github.com/Microsoft/OpenAPI.NET + https://github.com/microsoft/OpenAPI.NET/releases + true + http://go.microsoft.com/fwlink/?LinkID=288890 + https://github.com/Microsoft/OpenAPI.NET + © Microsoft Corporation. All rights reserved. + OpenAPI .NET + 3.1.2 + + + + true + + + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..25f1ec589 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +WORKDIR /app + +COPY ./src ./hidi/src +COPY ./Directory.Build.props ./hidi/Directory.Build.props +COPY ./README.md ./hidi/README.md +WORKDIR /app/hidi +RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release + +FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime +WORKDIR /app + +COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net8.0 ./ + +VOLUME /app/output +VOLUME /app/openapi.yml +VOLUME /app/api.csdl +VOLUME /app/collection.json +ENV HIDI_CONTAINER=true DOTNET_TieredPGO=1 DOTNET_TC_QuickJitForLoops=1 +ENTRYPOINT ["dotnet", "Microsoft.OpenApi.Hidi.dll"] +LABEL description="# Welcome to Hidi \ +To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/main/src/Microsoft.OpenApi.Hidi) \ +[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/main/Dockerfile)" diff --git a/Microsoft.OpenApi.sln b/Microsoft.OpenApi.sln index dc489bff8..b91029eca 100644 --- a/Microsoft.OpenApi.sln +++ b/Microsoft.OpenApi.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29613.14 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32210.238 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi", "src\Microsoft.OpenApi\Microsoft.OpenApi.csproj", "{A8E50143-69B2-472A-9D45-3F9A05D13202}" EndProject @@ -12,9 +12,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution readme.md = readme.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Workbench", "src\Microsoft.OpenApi.Workbench\Microsoft.OpenApi.Workbench.csproj", "{6A5E91E5-0441-46EE-AEB9-8334981B7F08}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Workbench", "src\Microsoft.OpenApi.Workbench\Microsoft.OpenApi.Workbench.csproj", "{6A5E91E5-0441-46EE-AEB9-8334981B7F08}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Readers", "src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj", "{79933258-0126-4382-8755-D50820ECC483}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.YamlReader", "src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj", "{79933258-0126-4382-8755-D50820ECC483}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Tests", "test\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj", "{AD83F991-DBF3-4251-8613-9CC54C826964}" EndProject @@ -24,9 +24,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E546B92F-20A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6357D7FD-2DE4-4900-ADB9-ABC37052040A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.SmokeTests", "test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj", "{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Trimming.Tests", "test\Microsoft.OpenApi.Trimming.Tests\Microsoft.OpenApi.Trimming.Tests.csproj", "{1D2E0C6E-B103-4CB6-912E-D56FA1501296}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{538936B4-5E14-4EA3-9FD0-F43E2DD014FB}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{6ADC5D41-EDD2-4206-B815-5DFF739C6832}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerformanceTests", "performance\benchmark\PerformanceTests.csproj", "{537E49E3-325E-40EE-A90E-7556D4D333AA}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "performance", "performance", "{4BB7E3F7-CA7E-45D3-B5AC-5DBB510FD528}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resultsComparer", "performance\resultsComparer\resultsComparer.csproj", "{5EEA836B-3E08-4BE1-82B8-5236D031B497}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -54,14 +62,26 @@ Global {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Debug|Any CPU.Build.0 = Debug|Any CPU {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.ActiveCfg = Release|Any CPU {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.Build.0 = Release|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.Build.0 = Release|Any CPU - {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.Build.0 = Release|Any CPU + {1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Release|Any CPU.Build.0 = Release|Any CPU + {538936B4-5E14-4EA3-9FD0-F43E2DD014FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {538936B4-5E14-4EA3-9FD0-F43E2DD014FB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {538936B4-5E14-4EA3-9FD0-F43E2DD014FB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {538936B4-5E14-4EA3-9FD0-F43E2DD014FB}.Release|Any CPU.Build.0 = Release|Any CPU + {6ADC5D41-EDD2-4206-B815-5DFF739C6832}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6ADC5D41-EDD2-4206-B815-5DFF739C6832}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6ADC5D41-EDD2-4206-B815-5DFF739C6832}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6ADC5D41-EDD2-4206-B815-5DFF739C6832}.Release|Any CPU.Build.0 = Release|Any CPU + {537E49E3-325E-40EE-A90E-7556D4D333AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {537E49E3-325E-40EE-A90E-7556D4D333AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {537E49E3-325E-40EE-A90E-7556D4D333AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {537E49E3-325E-40EE-A90E-7556D4D333AA}.Release|Any CPU.Build.0 = Release|Any CPU + {5EEA836B-3E08-4BE1-82B8-5236D031B497}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EEA836B-3E08-4BE1-82B8-5236D031B497}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EEA836B-3E08-4BE1-82B8-5236D031B497}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EEA836B-3E08-4BE1-82B8-5236D031B497}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -72,8 +92,10 @@ Global {79933258-0126-4382-8755-D50820ECC483} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1} {AD83F991-DBF3-4251-8613-9CC54C826964} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} - {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1} + {1D2E0C6E-B103-4CB6-912E-D56FA1501296} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} + {538936B4-5E14-4EA3-9FD0-F43E2DD014FB} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1} + {6ADC5D41-EDD2-4206-B815-5DFF739C6832} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} + {5EEA836B-3E08-4BE1-82B8-5236D031B497} = {4BB7E3F7-CA7E-45D3-B5AC-5DBB510FD528} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9F171EFC-0DB5-4B10-ABFA-AF48D52CC565} diff --git a/README.md b/README.md index 9405526bf..6a7f787f8 100644 --- a/README.md +++ b/README.md @@ -1,113 +1,124 @@ -![Category overview screenshot](docs/images/oainet.png "Microsoft + OpenAPI = Love") - -# OpenAPI.NET - -|Package|Nuget| -|--|--| -|Models and Writers|[![nuget](https://img.shields.io/nuget/v/Microsoft.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.OpenApi/) | -|Readers | [![nuget](https://img.shields.io/nuget/v/Microsoft.OpenApi.Readers.svg)](https://www.nuget.org/packages/Microsoft.OpenApi.Readers/) | - - -The **OpenAPI.NET** SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model. - -**See more information on the OpenAPI specification and its history here: OpenAPI Initiative** - -Project Objectives - -- Provide a single shared object model in .NET for OpenAPI descriptions. -- Include the most primitive Reader for ingesting OpenAPI JSON and YAML documents in both V2 and V3 formats. -- Provide OpenAPI description writers for both V2 and V3 specification formats. -- Enable developers to create Readers that translate different data formats into OpenAPI descriptions. - -# Installation - -- Install core Nuget package `Microsoft.OpenApi` -- Install readers Nuget package `Microsoft.OpenApi.Readers` - -# Processors -The OpenAPI.NET project holds the base object model for representing OpenAPI documents as .NET objects. Some developers have found the need to write processors that convert other data formats into this OpenAPI.NET object model. We'd like to curate that list of processors in this section of the readme. - -The base JSON and YAML processors are built into this project. Below is the list of the other supported processor projects. - -- [**C# Comment / Annotation Processor**](https://github.com/Microsoft/OpenAPI.NET.CSharpAnnotations) : Converts standard .NET annotations ( /// comments ) emitted from your build (MSBuild.exe) into OpenAPI.NET document object. - -- [**OData CSDL Processor**](https://github.com/Microsoft/OpenAPI.NET.OData) : Converts the XML representation of the Entity Data Model (EDM) describing an OData Service into OpenAPI.NET document object. - -# Example Usage - -Creating an OpenAPI Document - -```C# -var document = new OpenApiDocument -{ - Info = new OpenApiInfo - { - Version = "1.0.0", - Title = "Swagger Petstore (Simple)", - }, - Servers = new List - { - new OpenApiServer { Url = "http://petstore.swagger.io/api" } - }, - Paths = new OpenApiPaths - { - ["/pets"] = new OpenApiPathItem - { - Operations = new Dictionary - { - [OperationType.Get] = new OpenApiOperation - { - Description = "Returns all pets from the system that the user has access to", - Responses = new OpenApiResponses - { - ["200"] = new OpenApiResponse - { - Description = "OK" - } - } - } - } - } - } -}; -``` - -Reading and writing a OpenAPI description - -```C# -var httpClient = new HttpClient -{ - BaseAddress = new Uri("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/") -}; - -var stream = await httpClient.GetStreamAsync("master/examples/v3.0/petstore.yaml"); - -// Read V3 as YAML -var openApiDocument = new OpenApiStreamReader().Read(stream, out var diagnostic); - -// Write V2 as JSON -var outputString = openApiDocument.Serialize(OpenApiSpecVersion.OpenApi2_0, OpenApiFormat.Json); - -``` - -# Build Status - -|**master**| -|--| -|[![Build status](https://ci.appveyor.com/api/projects/status/9l6hly3vjeu0tmtx/branch/master?svg=true)](https://ci.appveyor.com/project/MicrosoftOpenAPINETAdmin/openapi-net-54e7i/branch/master)| - -# Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag or use the OpenAPI.NET Slack channel which you can join by registering for the HTTP APIs team at http://slack.httpapis.com. + +![Category overview screenshot](https://raw.githubusercontent.com/microsoft/OpenAPI.NET/main/docs/images/oainet.png "Microsoft + OpenAPI = Love") + +# OpenAPI.NET + +|Package|Nuget| +|--|--| +|Models and Writers|[![nuget](https://img.shields.io/nuget/v/Microsoft.OpenApi.svg)](https://www.nuget.org/packages/Microsoft.OpenApi/) | +|YamlReader | [![nuget](https://img.shields.io/nuget/v/Microsoft.OpenApi.YamlReader.svg)](https://www.nuget.org/packages/Microsoft.OpenApi.YamlReader/) | +|Hidi|[![nuget](https://img.shields.io/nuget/v/Microsoft.OpenApi.Hidi.svg)](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/) + +The **OpenAPI.NET** SDK contains a useful object model for OpenAPI documents in .NET along with common serializers to extract raw OpenAPI JSON and YAML documents from the model. + +**See more information on the OpenAPI specification and its history here: OpenAPI Initiative** + +Project Objectives: + +- Provide a single shared object model in .NET for OpenAPI descriptions. +- Include the most primitive Reader for ingesting OpenAPI JSON and YAML documents in both V2 and V3 formats. +- Provide OpenAPI description writers for both V2 and V3 specification formats. +- Enable developers to create Readers that translate different data formats into OpenAPI descriptions. + +# Installation + +- Install core Nuget package [**Microsoft.OpenApi**](https://www.nuget.org/packages/Microsoft.OpenApi) +- Install Yaml Reader Nuget package [**Microsoft.OpenApi.YamlReader**](https://www.nuget.org/packages/Microsoft.OpenApi.YamlReader) + +> Note: we just released a new major version of the library, which brings support for OpenAPI 3.2! +> You can read more about the changes of this upcoming version [in the upgrade guide](./docs/upgrade-guide-3.md). + +# Processors +The OpenAPI.NET project holds the base object model for representing OpenAPI documents as .NET objects. Some developers have found the need to write processors that convert other data formats into this OpenAPI.NET object model. We'd like to curate that list of processors in this section of the readme. + +The base JSON and YAML processors are built into this project. Below is the list of the other supported processor projects. + +- [**C# Comment / Annotation Processor**](https://github.com/Microsoft/OpenAPI.NET.CSharpAnnotations) : Converts standard .NET annotations ( /// comments ) emitted from your build (MSBuild.exe) into OpenAPI.NET document object. + +- [**OData CSDL Processor**](https://github.com/Microsoft/OpenAPI.NET.OData) : Converts the XML representation of the Entity Data Model (EDM) describing an OData Service into OpenAPI.NET document object. + +# Example Usage + +Creating an OpenAPI Document + +```C# +var document = new OpenApiDocument +{ + Info = new OpenApiInfo + { + Version = "1.0.0", + Title = "Swagger Petstore (Simple)", + }, + Servers = new List + { + new OpenApiServer { Url = "http://petstore.swagger.io/api" } + }, + Paths = new OpenApiPaths + { + ["/pets"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Get] = new OpenApiOperation + { + Description = "Returns all pets from the system that the user has access to", + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Description = "OK" + } + } + } + } + } + } +}; +``` + +Reading and writing an OpenAPI description + +```C# +var (openApiDocument, _) = await OpenApiDocument.LoadAsync("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/refs/heads/main/_archive_/schemas/v3.0/pass/petstore.yaml"); + +// Write V2 as JSON +var outputString = await openApiDocument.SerializeAsJsonAsync(OpenApiSpecVersion.OpenApi2_0); +``` + +# Validating/Testing OpenAPI descriptions +In order to test the validity of an OpenApi document, we avail the following tools: +- [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi) + + A commandline tool for validating and transforming OpenAPI descriptions. [Installation guidelines and documentation](https://github.com/microsoft/OpenAPI.NET/blob/main/src/Microsoft.OpenApi.Hidi/readme.md) + +- Microsoft.OpenApi.Workbench + + A workbench tool consisting of a GUI where you can test and convert OpenAPI descriptions in both JSON and YAML from v2-->v3 and vice versa. + + #### Installation guidelines: + 1. Clone the repo locally by running this command: + `git clone https://github.com/microsoft/OpenAPI.NET.git` + 2. Open the solution file `(.sln)` in the root of the project with Visual Studio + 3. Navigate to the `src/Microsoft.OpenApi.Workbench` directory and set it as the startup project + 4. Run the project and you'll see a GUI pop up resembling the one below: + + + ![workbench preview](https://raw.githubusercontent.com/microsoft/OpenAPI.NET/main/docs/images/workbench.png "a screenshot of the workbench application") + + 5. Copy and paste your OpenAPI descriptions in the **Input Content** window or paste the path to the descriptions file in the **Input File** textbox and click on `Convert` to render the results. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag. diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..766e6f887 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/msrc/pgp-key-msrc). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://microsoft.com/msrc/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/msrc/cvd). + + diff --git a/build.cmd b/build.cmd index 43cc95956..07daf7b6c 100644 --- a/build.cmd +++ b/build.cmd @@ -6,9 +6,9 @@ dotnet msbuild %PROJ% /t:restore /p:Configuration=Release dotnet msbuild %PROJ% /t:build /p:Configuration=Release dotnet msbuild %PROJ% /t:pack /p:Configuration=Release;PackageOutputPath=%~dp0artifacts -Echo Building Microsoft.OpenApi.Readers +Echo Building Microsoft.OpenApi.YamlReader -SET PROJ=%~dp0src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj +SET PROJ=%~dp0src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj dotnet msbuild %PROJ% /t:restore /p:Configuration=Release dotnet msbuild %PROJ% /t:build /p:Configuration=Release dotnet msbuild %PROJ% /t:pack /p:Configuration=Release;PackageOutputPath=%~dp0artifacts diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..0de30b6df --- /dev/null +++ b/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "Building Microsoft.OpenApi" + +PROJ="$(dirname "$0")/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj" +dotnet msbuild "$PROJ" /t:restore /p:Configuration=Release +dotnet msbuild "$PROJ" /t:build /p:Configuration=Release +dotnet msbuild "$PROJ" /t:pack "/p:Configuration=Release;PackageOutputPath=$(dirname "$0")/artifacts" + +echo "Building Microsoft.OpenApi.YamlReader" + +PROJ="$(dirname "$0")/src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj" +dotnet msbuild "$PROJ" /t:restore /p:Configuration=Release +dotnet msbuild "$PROJ" /t:build /p:Configuration=Release +dotnet msbuild "$PROJ" /t:pack "/p:Configuration=Release;PackageOutputPath=$(dirname "$0")/artifacts" + +echo "Building Microsoft.OpenApi.Hidi" + +PROJ="$(dirname "$0")/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj" +dotnet msbuild "$PROJ" /t:restore /p:Configuration=Release +dotnet msbuild "$PROJ" /t:build /p:Configuration=Release +dotnet msbuild "$PROJ" /t:pack "/p:Configuration=Release;PackageOutputPath=$(dirname "$0")/artifacts" \ No newline at end of file diff --git a/docs/CI-CD_DOCUMENTATION.md b/docs/CI-CD_DOCUMENTATION.md deleted file mode 100644 index 40053cf82..000000000 --- a/docs/CI-CD_DOCUMENTATION.md +++ /dev/null @@ -1,81 +0,0 @@ -# CI/CD documentation - -## 1. Run workflow manually - -1. Go to the project's GitHub repository and click on the **Actions** tab - -2. From the "Workflows" list on the left, click on "CI/CD Pipeline" - -3. On the right, next to the "This workflow has a workflow_dispatch event trigger" label, click on the "Run workflow" dropdown, make sure the default branch is selected (if not manually changed, should be main or master) in the "Use workflow from" dropdown and click the "Run workflow" button - -![Actions_workflow_dispatch](images/Actions_workflow_dispatch.png) - -NOTE: **screenshots are only exemplary** - -
- -## 2. Automated NuGet publishing - -To setup the automated publishing to NuGet: - -1. Go to the repo **Settings** tab -> **Secrets** - -2. Add a secret with the name `NUGET_API_KEY` and as value use an API key from NuGet.org that is assigned to the packages for this project - -NOTE: the automated NuGet publishing is execute **only** when a release is triggered by the ["Automated versioning" feature](#3-automated-versioning) - -
- -## 3. Automated versioning - -Automatically bumps up the GitHub tag in the repo and executes the CD job - -Note: **not every commit to your default branch creates a release** - -Follow these instructions for any commit (push or PR merge) to your default branch, you would like to execute the automated versioning. - -You would need one of three keywords at the start of your commit title. Each of the three keywords corresponds to a number in your release version i.e. v1.2.3. The release versioning uses the ["Conventional Commits" specification](https://www.conventionalcommits.org/en/v1.0.0/): - -- "fix: ..." - this keyword corresponds to the last number v1.2.**3**, also known as PATCH; -- "feat: ..." - this keyword corresponds to the middle number v1.**2**.3, also known as MINOR; -- "perf: ..." - this keyword corresponds to the first number v**1**.2.3, also known as MAJOR. In addition, to trigger a MAJOR release, you would need to write "BREAKING CHANGE: ..." in the description of the commit, with an empty line above it to indicate it is in the