-
Notifications
You must be signed in to change notification settings - Fork 275
Expand file tree
/
Copy pathAnyMapFieldMapParameter.cs
More file actions
48 lines (42 loc) · 1.57 KB
/
AnyMapFieldMapParameter.cs
File metadata and controls
48 lines (42 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using Microsoft.OpenApi.Models;
namespace Microsoft.OpenApi.Reader.ParseNodes
{
internal class AnyMapFieldMapParameter<T, U>
{
/// <summary>
/// Constructor
/// </summary>
public AnyMapFieldMapParameter(
Func<T, IDictionary<string, U>> propertyMapGetter,
Func<U, JsonNode> propertyGetter,
Action<U, JsonNode> propertySetter,
Func<T, OpenApiSchema> schemaGetter)
{
this.PropertyMapGetter = propertyMapGetter;
this.PropertyGetter = propertyGetter;
this.PropertySetter = propertySetter;
this.SchemaGetter = schemaGetter;
}
/// <summary>
/// Function to retrieve the property that is a map from string to an inner element containing IOpenApiAny.
/// </summary>
public Func<T, IDictionary<string, U>> PropertyMapGetter { get; }
/// <summary>
/// Function to retrieve the value of the property from an inner element.
/// </summary>
public Func<U, JsonNode> PropertyGetter { get; }
/// <summary>
/// Function to set the value of the property.
/// </summary>
public Action<U, JsonNode> PropertySetter { get; }
/// <summary>
/// Function to get the schema to apply to the property.
/// </summary>
public Func<T, OpenApiSchema> SchemaGetter { get; }
}
}