Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ trigger:
branches:
include:
- main
- dev
- support/v1
tags:
include:
Expand All @@ -15,7 +14,6 @@ pr:
branches:
include:
- main
- dev
- support/v1
variables:
buildPlatform: 'Any CPU'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CodeQL Analysis

on:
push:
branches: [ main, dev ]
branches: [ main, support/v1 ]
pull_request:
schedule:
- cron: '0 8 * * *'
Expand Down
22 changes: 17 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ name: Publish Docker image
on:
workflow_dispatch:
push:
branches: [main, dev, support/v1]
paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**']
tags: ["v*"]
branches: [main]
pull_request:
env:
REGISTRY: msgraphprod.azurecr.io
IMAGE_NAME: public/openapi/hidi
PREVIEW_BRANCH: "refs/heads/main"
jobs:
push_to_registry:
environment:
Expand All @@ -28,14 +30,24 @@ jobs:
echo "::set-output name=version::${version}"
shell: pwsh
id: getversion
- name: Get truncated run number
if: contains(github.ref, env.PREVIEW_BRANCH)
id: runnumber
run: echo "runnumber=$(echo ${{ github.run_number }} | awk '{ print substr($0, length($0)-3, length($0)) }')" >> $GITHUB_OUTPUT
- name: Get current date
if: contains(github.ref, env.PREVIEW_BRANCH)
id: date
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- name: Push to registry - Nightly
if: ${{ github.ref == 'refs/heads/dev' }}
if: contains(github.ref, env.PREVIEW_BRANCH)
uses: docker/build-push-action@v6.13.0
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}-preview.${{ steps.date.outputs.date }}${{ steps.runnumber.outputs.runnumber }}
build-args: |
version_suffix=preview.${{ steps.date.outputs.date }}${{ steps.runnumber.outputs.runnumber }}
- name: Push to registry - Release
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/support/v1' }}
if: contains(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v6.13.0
with:
push: true
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.0.0-preview5"
".": "2.0.0-preview6"
}
140 changes: 139 additions & 1 deletion CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@
<PackageProjectUrl>https://github.com/Microsoft/OpenAPI.NET</PackageProjectUrl>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageTags>OpenAPI .NET</PackageTags>
<Version>2.0.0-preview5</Version>
<Version>2.0.0-preview6</Version>
</PropertyGroup>
<!-- https://github.com/clairernovotny/DeterministicBuilds#deterministic-builds -->
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference
Condition="!$(MSBuildProjectName.EndsWith('Tests'))"
Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Condition="!$(MSBuildProjectName.EndsWith('Tests'))" Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/OpenApiSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ internal void WriteJsonSchemaKeywords(IOpenApiWriter writer)
internal void WriteAsItemsProperties(IOpenApiWriter writer)
{
// type
writer.WriteProperty(OpenApiConstants.Type, Type.ToIdentifier());
writer.WriteProperty(OpenApiConstants.Type, (Type & ~JsonSchemaType.Null).ToIdentifier());

// format
WriteFormatProperty(writer);
Expand Down
30 changes: 30 additions & 0 deletions test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,36 @@ public async Task SerializeSchemaWithUnrecognizedPropertiesWorks()
Assert.Equal(expected.MakeLineBreaksEnvironmentNeutral(), actual.MakeLineBreaksEnvironmentNeutral());
}

[Fact]
public async Task WriteAsItemsPropertiesDoesNotWriteNull()
{
// Arrange
var schema = new OpenApiSchema
{
Type = JsonSchemaType.Number | JsonSchemaType.Null
};

var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
var writer = new OpenApiJsonWriter(outputStringWriter, new() { Terse = false });
writer.WriteStartObject();

// Act
schema.WriteAsItemsProperties(writer);
writer.WriteEndObject();
await writer.FlushAsync();

// Assert
var actual = outputStringWriter.GetStringBuilder().ToString();
var expected =
"""
{
"type": "number"
}
""";
Assert.True(JsonNode.DeepEquals(JsonNode.Parse(expected), JsonNode.Parse(actual)));
}


internal class SchemaVisitor : OpenApiVisitorBase
{
public List<string> Titles = new();
Expand Down