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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.Collections.Generic;
using System.CommandLine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static PowerShellFormatter()
{
// Add singularization exclusions.
// Enhancement: Read exclusions from a user provided file.
Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive.
Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive.
Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization.
Vocabularies.Default.AddSingular("(delta)$", "$1");
Vocabularies.Default.AddSingular("(quota)$", "$1");
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static ILoggerFactory ConfigureLogger(LogLevel logLevel)
{
c.IncludeScopes = true;
})
#if DEBUG
#if DEBUG
.AddDebug()
#endif
.SetMinimumLevel(logLevel);
Expand Down
7 changes: 3 additions & 4 deletions src/Microsoft.OpenApi.Hidi/OpenApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger,
requestUrls = EnumerateJsonDocument(postmanCollection.RootElement, new());
logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection.");
}
else
else
{
requestUrls = new();
logger.LogTrace("No filter options provided.");
Expand Down Expand Up @@ -211,10 +211,9 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma
}
}

// Get OpenAPI document either from OpenAPI or CSDL
// Get OpenAPI document either from OpenAPI or CSDL
private static async Task<OpenApiDocument> GetOpenApi(HidiOptions options, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default)
{

OpenApiDocument document;
Stream stream;

Expand Down Expand Up @@ -285,7 +284,7 @@ private static async Task<OpenApiDocument> GetOpenApi(HidiOptions options, ILogg

private static Dictionary<string, List<string>> GetRequestUrlsFromManifest(ApiDependency apiDependency)
{
// Get the request URLs from the API Dependencies in the API manifest
// Get the request URLs from the API Dependencies in the API manifest
var requests = apiDependency
.Requests.Where(static r => !r.Exclude && !string.IsNullOrEmpty(r.UriTemplate) && !string.IsNullOrEmpty(r.Method))
.Select(static r => new { UriTemplate = r.UriTemplate!, Method = r.Method! })
Expand Down
1 change: 0 additions & 1 deletion src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value)

if (int.TryParse(res, out int result))
{

if (result >= 2 && result < 3)
{
return OpenApiSpecVersion.OpenApi2_0;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ public IReadOnlyList<Option> GetPluginCommandOptions()
LogLevelOption
};
}

}

}
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

namespace Microsoft.OpenApi.Hidi.Options
{
Expand All @@ -8,6 +8,6 @@ internal class FilterOptions
public string? FilterByOperationIds { get; internal set; }
public string? FilterByTags { get; internal set; }
public string? FilterByCollection { get; internal set; }
public string? FilterByApiManifest { get; internal set; }
public string? FilterByApiManifest { get; internal set; }
}
}
3 changes: 1 addition & 2 deletions src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.CommandLine.Parsing;
using System.IO;
Expand Down Expand Up @@ -35,7 +35,6 @@ public HidiOptions(ParseResult parseResult, CommandOptions options)

public HidiOptions()
{

}

private void ParseHidiOptions(ParseResult parseResult, CommandOptions options)
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/StatsVisitor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using Microsoft.Extensions.Configuration;
using Microsoft.OpenApi.OData;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using Microsoft.OpenApi.Exceptions;
Expand Down Expand Up @@ -51,6 +51,5 @@ public OpenApiReaderException(string message, YamlNode node) : base(message)
/// <param name="message">Plain text error message for this exception.</param>
/// <param name="innerException">Inner exception that caused this exception to be thrown.</param>
public OpenApiReaderException(string message, Exception innerException) : base(message, innerException) { }

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Globalization;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Interface/IDiagnostic.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

namespace Microsoft.OpenApi.Readers.Interface
{
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Interface/IOpenApiReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using Microsoft.OpenApi.Models;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
Expand All @@ -12,7 +12,6 @@ namespace Microsoft.OpenApi.Readers.Interface
/// </summary>
internal interface IOpenApiVersionService
{

/// <summary>
/// Parse the string to a <see cref="OpenApiReference"/> object.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/Interface/IStreamLoader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiDiagnostic.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.Collections.Generic;
using Microsoft.OpenApi.Models;
Expand Down
14 changes: 7 additions & 7 deletions src/Microsoft.OpenApi.Readers/OpenApiReaderSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class OpenApiReaderSettings
/// from an <see cref="OpenApiStreamReader"/> object.
/// </summary>
public bool LeaveStreamOpen { get; set; }

/// <summary>
/// Adds parsers for Microsoft OpenAPI extensions:
/// - <see cref="OpenApiPagingExtension"/>
Expand All @@ -93,17 +93,17 @@ public class OpenApiReaderSettings
/// </summary>
public void AddMicrosoftExtensionParsers()
{
if (!ExtensionParsers.ContainsKey(OpenApiPagingExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiPagingExtension.Name))
ExtensionParsers.Add(OpenApiPagingExtension.Name, static (i, _) => OpenApiPagingExtension.Parse(i));
if (!ExtensionParsers.ContainsKey(OpenApiEnumValuesDescriptionExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiEnumValuesDescriptionExtension.Name))
ExtensionParsers.Add(OpenApiEnumValuesDescriptionExtension.Name, static (i, _ ) => OpenApiEnumValuesDescriptionExtension.Parse(i));
if (!ExtensionParsers.ContainsKey(OpenApiPrimaryErrorMessageExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiPrimaryErrorMessageExtension.Name))
ExtensionParsers.Add(OpenApiPrimaryErrorMessageExtension.Name, static (i, _ ) => OpenApiPrimaryErrorMessageExtension.Parse(i));
if (!ExtensionParsers.ContainsKey(OpenApiDeprecationExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiDeprecationExtension.Name))
ExtensionParsers.Add(OpenApiDeprecationExtension.Name, static (i, _ ) => OpenApiDeprecationExtension.Parse(i));
if (!ExtensionParsers.ContainsKey(OpenApiReservedParameterExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiReservedParameterExtension.Name))
ExtensionParsers.Add(OpenApiReservedParameterExtension.Name, static (i, _ ) => OpenApiReservedParameterExtension.Parse(i));
if (!ExtensionParsers.ContainsKey(OpenApiEnumFlagsExtension.Name))
if (!ExtensionParsers.ContainsKey(OpenApiEnumFlagsExtension.Name))
ExtensionParsers.Add(OpenApiEnumFlagsExtension.Name, static (i, _ ) => OpenApiEnumFlagsExtension.Parse(i));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiStringReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.IO;
using Microsoft.OpenApi.Interfaces;
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.OpenApi.Readers/OpenApiTextReaderReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.IO;
using System.Linq;
Expand Down Expand Up @@ -83,7 +83,6 @@ public async Task<ReadResult> ReadAsync(TextReader input, CancellationToken canc
return await new OpenApiYamlDocumentReader(this._settings).ReadAsync(yamlDocument, cancellationToken);
}


/// <summary>
/// Reads the stream input and parses the fragment of an OpenAPI description into an Open API Element.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/AnyFieldMap.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using Microsoft.OpenApi.Any;
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.OpenApi.Readers/ParseNodes/AnyListFieldMap.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.Collections.Generic;

namespace Microsoft.OpenApi.Readers.ParseNodes
{
internal class AnyListFieldMap<T> : Dictionary<string, AnyListFieldMapParameter<T>>
{

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.OpenApi.Readers/ParseNodes/AnyMapFieldMap.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System.Collections.Generic;

namespace Microsoft.OpenApi.Readers.ParseNodes
{
internal class AnyMapFieldMap<T, U> : Dictionary<string, AnyMapFieldMapParameter<T, U>>
{

}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/FixedFieldMap.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using SharpYaml.Serialization;
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections;
Expand Down
12 changes: 6 additions & 6 deletions src/Microsoft.OpenApi.Readers/ParseNodes/MapNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections;
Expand Down Expand Up @@ -66,8 +66,8 @@ public override Dictionary<string, T> CreateMap<T>(Func<MapNode, T> map)
}

var nodes = yamlMap.Select(
n => {
n =>
{
var key = n.Key.GetScalarValue();
T value;
try
Expand All @@ -76,7 +76,7 @@ public override Dictionary<string, T> CreateMap<T>(Func<MapNode, T> map)
value = n.Value as YamlMappingNode == null
? default
: map(new MapNode(Context, n.Value as YamlMappingNode));
}
}
finally
{
Context.EndObject();
Expand All @@ -93,7 +93,7 @@ public override Dictionary<string, T> CreateMap<T>(Func<MapNode, T> map)

public override Dictionary<string, T> CreateMapWithReference<T>(
ReferenceType referenceType,
Func<MapNode, T> map)
Func<MapNode, T> map)
{
var yamlMap = _node;
if (yamlMap == null)
Expand Down Expand Up @@ -141,7 +141,7 @@ public override Dictionary<string, T> CreateSimpleMap<T>(Func<ValueNode, T> map)
{
var yamlMap = _node;
if (yamlMap == null)
{
{
throw new OpenApiReaderException($"Expected map while parsing {typeof(T).Name}", Context);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Globalization;
Expand Down Expand Up @@ -260,7 +260,7 @@ public static IOpenApiAny GetSpecificOpenApiAny(IOpenApiAny openApiAny, OpenApiS
}

// If data conflicts with the given type, return a string.
// This converter is used in the parser, so it does not perform any validations,
// This converter is used in the parser, so it does not perform any validations,
// but the validator can be used to validate whether the data and given type conflicts.
return apiString;
}
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.OpenApi.Readers/ParseNodes/ParseNode.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -32,7 +32,6 @@ public MapNode CheckMapNode(string nodeName)

public static ParseNode Create(ParsingContext context, YamlNode node)
{

if (node is YamlSequenceNode listNode)
{
return new ListNode(context, listNode);
Expand Down
Loading