- code linting

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
Vincent Biret 2021-11-22 12:43:05 -05:00
parent 70aefe98a1
commit 960b31b350
No known key found for this signature in database
GPG key ID: 32426322EDFFB7E3
4 changed files with 16 additions and 17 deletions

View file

@ -146,8 +146,8 @@ namespace Microsoft.OpenApi.OData.Edm
// From Open API spec, parameter name is case sensitive, so don't use the IgnoreCase HashSet.
// HashSet<string> parameters = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
HashSet<string> parameters = new HashSet<string>();
StringBuilder sb = new StringBuilder();
HashSet<string> parameters = new();
StringBuilder sb = new();
if (!string.IsNullOrWhiteSpace(settings.PathPrefix))
{

View file

@ -42,21 +42,20 @@ namespace Microsoft.OpenApi.OData
if (settings.VerifyEdmModel)
{
IEnumerable<EdmError> errors;
if (!model.Validate(out errors))
{
OpenApiDocument document = new OpenApiDocument();
int index = 1;
foreach (var error in errors)
{
document.Extensions.Add(Constants.xMsEdmModelError + index++, new OpenApiString(error.ToString()));
}
if (!model.Validate(out var errors))
{
OpenApiDocument document = new();
int index = 1;
foreach (var error in errors)
{
document.Extensions.Add(Constants.xMsEdmModelError + index++, new OpenApiString(error.ToString()));
}
return document;
}
}
return document;
}
}
ODataContext context = new ODataContext(model, settings);
ODataContext context = new(model, settings);
return context.CreateDocument();
}
}

View file

@ -54,7 +54,7 @@ namespace Microsoft.OpenApi.OData.Generator
if (settings.ShowRootPath)
{
OpenApiPathItem rootPath = new OpenApiPathItem()
OpenApiPathItem rootPath = new()
{
Operations = new Dictionary<OperationType, OpenApiOperation> {
{

View file

@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.OData.PathItem
/// </summary>
internal class PathItemHandlerProvider : IPathItemHandlerProvider
{
private IDictionary<ODataPathKind, IPathItemHandler> _handlers = new Dictionary<ODataPathKind, IPathItemHandler>
private readonly IDictionary<ODataPathKind, IPathItemHandler> _handlers = new Dictionary<ODataPathKind, IPathItemHandler>
{
// EntitySet
{ ODataPathKind.EntitySet, new EntitySetPathItemHandler() },