- code linting

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
Vincent Biret 2021-11-22 14:23:22 -05:00
parent ae11d65007
commit 2fee91b384
No known key found for this signature in database
GPG key ID: 32426322EDFFB7E3

View file

@ -14,88 +14,82 @@ namespace Microsoft.OpenApi.OData.Operation
/// </summary>
internal class OperationHandlerProvider : IOperationHandlerProvider
{
private IDictionary<ODataPathKind, IDictionary<OperationType, IOperationHandler>> _handlers;
/// <summary>
/// Initializes a new instance of <see cref="OperationHandlerProvider"/> class.
/// </summary>
public OperationHandlerProvider()
{
_handlers = new Dictionary<ODataPathKind, IDictionary<OperationType, IOperationHandler>>();
private readonly IDictionary<ODataPathKind, IDictionary<OperationType, IOperationHandler>> _handlers
= new Dictionary<ODataPathKind, IDictionary<OperationType, IOperationHandler>>{
// entity set (Get/Post)
_handlers[ODataPathKind.EntitySet] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.EntitySet, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new EntitySetGetOperationHandler() },
{OperationType.Post, new EntitySetPostOperationHandler() }
};
}},
// entity (Get/Patch/Delete)
_handlers[ODataPathKind.Entity] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.Entity, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new EntityGetOperationHandler() },
{OperationType.Patch, new EntityPatchOperationHandler() },
{OperationType.Delete, new EntityDeleteOperationHandler() }
};
}},
// singleton (Get/Patch)
_handlers[ODataPathKind.Singleton] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.Singleton, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new SingletonGetOperationHandler() },
{OperationType.Patch, new SingletonPatchOperationHandler() }
};
}},
// edm operation (Get|Post)
_handlers[ODataPathKind.Operation] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.Operation, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new EdmFunctionOperationHandler() },
{OperationType.Post, new EdmActionOperationHandler() }
};
}},
// edm operation import (Get|Post)
_handlers[ODataPathKind.OperationImport] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.OperationImport, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new EdmFunctionImportOperationHandler() },
{OperationType.Post, new EdmActionImportOperationHandler() }
};
}},
// navigation property (Get/Patch/Post/Delete)
_handlers[ODataPathKind.NavigationProperty] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.NavigationProperty, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new NavigationPropertyGetOperationHandler() },
{OperationType.Patch, new NavigationPropertyPatchOperationHandler() },
{OperationType.Post, new NavigationPropertyPostOperationHandler() },
{OperationType.Delete, new NavigationPropertyDeleteOperationHandler() }
};
}},
// navigation property ref (Get/Post/Put/Delete)
_handlers[ODataPathKind.Ref] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.Ref, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new RefGetOperationHandler() },
{OperationType.Put, new RefPutOperationHandler() },
{OperationType.Post, new RefPostOperationHandler() },
{OperationType.Delete, new RefDeleteOperationHandler() }
};
}},
// media entity operation (Get|Put)
_handlers[ODataPathKind.MediaEntity] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.MediaEntity, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new MediaEntityGetOperationHandler() },
{OperationType.Put, new MediaEntityPutOperationHandler() }
};
}},
// $metadata operation (Get)
_handlers[ODataPathKind.Metadata] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.Metadata, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new MetadataGetOperationHandler() }
};
}},
// $count operation (Get)
_handlers[ODataPathKind.DollarCount] = new Dictionary<OperationType, IOperationHandler>
{ODataPathKind.DollarCount, new Dictionary<OperationType, IOperationHandler>
{
{OperationType.Get, new DollarCountGetOperationHandler() }
};
}
}},
};
/// <inheritdoc/>
public IOperationHandler GetHandler(ODataPathKind pathKind, OperationType operationType)