Skip to content

Commit 7e024c0

Browse files
committed
Resolve conflicts
1 parent 442ca2f commit 7e024c0

36 files changed

+583
-546
lines changed

src/Microsoft.OpenApi.Readers/ParseNodes/ValueNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ValueNode(ParsingContext context, JsonNode node) : base(
2020
_node = scalarNode;
2121
}
2222

23-
public override string GetScalarValue() => _node.GetValue<string>();
23+
public override string GetScalarValue() => _node.GetScalarValue();
2424

2525
/// <summary>
2626
/// Create a <see cref="JsonNode"/>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
3+
4+
using System;
5+
using Microsoft.OpenApi.Interfaces;
6+
using Microsoft.OpenApi.Writers;
7+
8+
namespace Microsoft.OpenApi.Extensions
9+
{
10+
/// <summary>
11+
/// Class implementing IOpenApiExtension interface
12+
/// </summary>
13+
/// <typeparam name="T"></typeparam>
14+
public class ExtensionTypeCaster<T> : IOpenApiExtension
15+
{
16+
private readonly T _value;
17+
18+
/// <summary>
19+
/// Assigns the value of type T to the x-extension key in an Extensions dictionary
20+
/// </summary>
21+
/// <param name="value"></param>
22+
public ExtensionTypeCaster(T value)
23+
{
24+
_value = value;
25+
}
26+
27+
/// <inheritdoc/>
28+
public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
29+
{
30+
writer.WriteValue(_value);
31+
}
32+
}
33+
}

test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

4-
using System.Collections.Generic;
5-
using System.Security.Policy;
6-
using Microsoft.OpenApi.Any;
4+
using System.Text.Json.Nodes;
5+
using Microsoft.OpenApi.Extensions;
76
using Microsoft.OpenApi.Interfaces;
87
using Microsoft.OpenApi.Models;
98

@@ -599,7 +598,7 @@ public static OpenApiDocument CreateOpenApiDocument()
599598
Extensions = new Dictionary<string, IOpenApiExtension>
600599
{
601600
{
602-
"x-ms-docs-key-type", new OpenApiString("call")
601+
"x-ms-docs-key-type", new ExtensionTypeCaster<string>("call")
603602
}
604603
}
605604
}
@@ -616,7 +615,7 @@ public static OpenApiDocument CreateOpenApiDocument()
616615
Extensions = new Dictionary<string, IOpenApiExtension>
617616
{
618617
{
619-
"x-ms-docs-operation-type", new OpenApiString("action")
618+
"x-ms-docs-operation-type", new ExtensionTypeCaster<string>("action")
620619
}
621620
}
622621
}
@@ -654,7 +653,7 @@ public static OpenApiDocument CreateOpenApiDocument()
654653
Extensions = new Dictionary<string, IOpenApiExtension>
655654
{
656655
{
657-
"x-ms-docs-key-type", new OpenApiString("group")
656+
"x-ms-docs-key-type", new ExtensionTypeCaster<string>("group")
658657
}
659658
}
660659
},
@@ -671,7 +670,7 @@ public static OpenApiDocument CreateOpenApiDocument()
671670
Extensions = new Dictionary<string, IOpenApiExtension>
672671
{
673672
{
674-
"x-ms-docs-key-type", new OpenApiString("event")
673+
"x-ms-docs-key-type", new ExtensionTypeCaster<string>("event")
675674
}
676675
}
677676
}
@@ -706,7 +705,7 @@ public static OpenApiDocument CreateOpenApiDocument()
706705
Extensions = new Dictionary<string, IOpenApiExtension>
707706
{
708707
{
709-
"x-ms-docs-operation-type", new OpenApiString("function")
708+
"x-ms-docs-operation-type", new ExtensionTypeCaster<string>("function")
710709
}
711710
}
712711
}

0 commit comments

Comments
 (0)