Skip to content

Commit 08b21d1

Browse files
authored
Merge pull request #855 from microsoft/vnext
hidi release
2 parents 5eb1481 + f06e828 commit 08b21d1

File tree

12 files changed

+33
-33
lines changed

12 files changed

+33
-33
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Initialize CodeQL
2525
id: init_codeql
26-
uses: github/codeql-action/init@v1
26+
uses: github/codeql-action/init@v2
2727
with:
2828
queries: security-and-quality
2929

@@ -43,6 +43,6 @@ jobs:
4343
4444
- name: Perform CodeQL Analysis
4545
id: analyze_codeql
46-
uses: github/codeql-action/analyze@v1
46+
uses: github/codeql-action/analyze@v2
4747

4848
# Built with ❤ by [Pipeline Foundation](https://pipeline.foundation)

src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
<PackageId>Microsoft.OpenApi.Hidi</PackageId>
1616
<ToolCommandName>hidi</ToolCommandName>
1717
<PackageOutputPath>./../../artifacts</PackageOutputPath>
18-
<Version>1.0.0-preview1</Version>
18+
<Version>1.0.0-preview2</Version>
1919
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
2020
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
2121
<PackageTags>OpenAPI .NET</PackageTags>
2222
<RepositoryUrl>https://github.com/Microsoft/OpenAPI.NET</RepositoryUrl>
2323
<PackageReleaseNotes>
24-
- Upgrades Microsoft.OpenApi.OData to 1.0.10-preview1
25-
- Fixes an issue where hidi would not process async operations
24+
- Upgrades Microsoft.OpenApi.OData to 1.0.10
25+
- Upgrades Microsoft.OData.Edm to 7.11.0
2626
</PackageReleaseNotes>
2727
<AssemblyName>Microsoft.OpenApi.Hidi</AssemblyName>
2828
<RootNamespace>Microsoft.OpenApi.Hidi</RootNamespace>
@@ -45,8 +45,8 @@
4545
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
4646
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
4747
<PackageReference Include="System.CommandLine" Version="2.0.0-beta3.22114.1" />
48-
<PackageReference Include="Microsoft.OData.Edm" Version="7.10.0" />
49-
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.0.10-preview3" />
48+
<PackageReference Include="Microsoft.OData.Edm" Version="7.11.0" />
49+
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.0.10" />
5050
</ItemGroup>
5151

5252
<ItemGroup>

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public static async Task<int> TransformOpenApiDocument(
4444
bool cleanoutput,
4545
string? version,
4646
OpenApiFormat? format,
47+
bool terseOutput,
4748
LogLevel loglevel,
4849
bool inlineLocal,
4950
bool inlineExternal,
@@ -196,7 +197,7 @@ CancellationToken cancellationToken
196197

197198
IOpenApiWriter writer = openApiFormat switch
198199
{
199-
OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings),
200+
OpenApiFormat.Json => terseOutput ? new OpenApiJsonWriter(textWriter, settings, terseOutput) : new OpenApiJsonWriter(textWriter, settings, false),
200201
OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings),
201202
_ => throw new ArgumentException("Unknown format"),
202203
};

src/Microsoft.OpenApi.Hidi/Program.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ static async Task Main(string[] args)
3939
var formatOption = new Option<OpenApiFormat?>("--format", "File format");
4040
formatOption.AddAlias("-f");
4141

42+
var terseOutputOption = new Option<bool>("--terse-output", "Produce terse json output");
43+
terseOutputOption.AddAlias("-to");
44+
4245
var logLevelOption = new Option<LogLevel>("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output.");
4346
logLevelOption.AddAlias("-ll");
4447

@@ -74,6 +77,7 @@ static async Task Main(string[] args)
7477
cleanOutputOption,
7578
versionOption,
7679
formatOption,
80+
terseOutputOption,
7781
logLevelOption,
7882
filterByOperationIdsOption,
7983
filterByTagsOption,
@@ -82,8 +86,8 @@ static async Task Main(string[] args)
8286
inlineExternalOption
8387
};
8488

85-
transformCommand.SetHandler<string, string, string, FileInfo, bool, string?, OpenApiFormat?, LogLevel, bool, bool, string, string, string, CancellationToken> (
86-
OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption);
89+
transformCommand.SetHandler<string, string, string, FileInfo, bool, string?, OpenApiFormat?, bool, LogLevel, bool, bool, string, string, string, CancellationToken> (
90+
OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, terseOutputOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption);
8791

8892
rootCommand.Add(transformCommand);
8993
rootCommand.Add(validateCommand);

src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</ItemGroup>
4141

4242
<ItemGroup>
43-
<PackageReference Include="SharpYaml" Version="1.9.0" />
43+
<PackageReference Include="SharpYaml" Version="1.9.1" />
4444
</ItemGroup>
4545

4646
<ItemGroup>

src/Microsoft.OpenApi/Extensions/OpenApiSerializableExtensions.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,14 @@ public static void Serialize<T>(
8383
throw Error.ArgumentNull(nameof(stream));
8484
}
8585

86-
IOpenApiWriter writer;
8786
var streamWriter = new FormattingStreamWriter(stream, CultureInfo.InvariantCulture);
88-
switch (format)
89-
{
90-
case OpenApiFormat.Json:
91-
writer = new OpenApiJsonWriter(streamWriter,settings);
92-
break;
93-
case OpenApiFormat.Yaml:
94-
writer = new OpenApiYamlWriter(streamWriter, settings);
95-
break;
96-
default:
97-
throw new OpenApiException(string.Format(SRResource.OpenApiFormatNotSupported, format));
98-
}
9987

88+
IOpenApiWriter writer = format switch
89+
{
90+
OpenApiFormat.Json => new OpenApiJsonWriter(streamWriter, settings, false),
91+
OpenApiFormat.Yaml => new OpenApiYamlWriter(streamWriter, settings),
92+
_ => throw new OpenApiException(string.Format(SRResource.OpenApiFormatNotSupported, format)),
93+
};
10094
element.Serialize(writer, specVersion);
10195
}
10296

src/Microsoft.OpenApi/Writers/OpenApiJsonWriter.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ public OpenApiJsonWriter(TextWriter textWriter, OpenApiJsonWriterSettings settin
3333
/// </summary>
3434
/// <param name="textWriter">The text writer.</param>
3535
/// <param name="settings">Settings for controlling how the OpenAPI document will be written out.</param>
36-
public OpenApiJsonWriter(TextWriter textWriter, OpenApiWriterSettings settings) : base(textWriter, settings)
36+
/// <param name="terseOutput"> Setting for allowing the JSON emitted to be in terse format.</param>
37+
public OpenApiJsonWriter(TextWriter textWriter, OpenApiWriterSettings settings, bool terseOutput = false) : base(textWriter, settings)
3738
{
39+
_produceTerseOutput = terseOutput;
3840
}
3941

4042
/// <summary>

src/Microsoft.OpenApi/Writers/OpenApiWriterSettings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public ReferenceInlineSetting ReferenceInline {
6969
/// </summary>
7070
public bool InlineExternalReferences { get; set; } = false;
7171

72-
7372
internal bool ShouldInlineReference(OpenApiReference reference)
7473
{
7574
return (reference.IsLocal && InlineLocalReferences)

test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@
247247
</PackageReference>
248248
<PackageReference Include="Newtonsoft.Json" Version="13.0.1">
249249
</PackageReference>
250-
<PackageReference Include="SharpYaml" Version="1.9.0">
250+
<PackageReference Include="SharpYaml" Version="1.9.1">
251251
</PackageReference>
252252
<PackageReference Include="xunit" Version="2.4.1">
253253
</PackageReference>
254-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
254+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
255255
<PrivateAssets>all</PrivateAssets>
256256
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
257257
</PackageReference>

test/Microsoft.OpenApi.SmokeTests/Microsoft.OpenApi.SmokeTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1313
<PackageReference Include="xunit" Version="2.4.1" />
14-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
14+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1515
<PrivateAssets>all</PrivateAssets>
1616
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1717
</PackageReference>

0 commit comments

Comments
 (0)