diff --git a/docs/upgrade-guide-2.md b/docs/upgrade-guide-2.md
index f1fd6c23f..ebe3acb5b 100644
--- a/docs/upgrade-guide-2.md
+++ b/docs/upgrade-guide-2.md
@@ -203,7 +203,7 @@ var openApiObject = new OpenApiObject
}
};
var parameter = new OpenApiParameter();
-parameter.Extensions.Add("x-foo", new OpenApiAny(openApiObject));
+parameter.Extensions.Add("x-foo", openApiObject);
```
@@ -223,7 +223,7 @@ var openApiObject = new JsonObject
}
};
var parameter = new OpenApiParameter();
-parameter.Extensions.Add("x-foo", new OpenApiAny(openApiObject));
+parameter.Extensions.Add("x-foo", new JsonNodeExtension(openApiObject));
```
diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs
index 368b67e8c..1287e704d 100644
--- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs
+++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs
@@ -1,4 +1,4 @@
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using System.Collections.Generic;
using System.Text.Json.Nodes;
@@ -15,7 +15,7 @@ internal static class OpenApiExtensibleExtensions
/// A value matching the provided extensionKey. Return null when extensionKey is not found.
internal static string GetExtension(this Dictionary extensions, string extensionKey)
{
- if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue))
+ if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue))
{
return stringValue;
}
diff --git a/src/Microsoft.OpenApi/Any/OpenApiAny.cs b/src/Microsoft.OpenApi/Extensions/JsonNodeExtension.cs
similarity index 76%
rename from src/Microsoft.OpenApi/Any/OpenApiAny.cs
rename to src/Microsoft.OpenApi/Extensions/JsonNodeExtension.cs
index 54bddf326..d0598f592 100644
--- a/src/Microsoft.OpenApi/Any/OpenApiAny.cs
+++ b/src/Microsoft.OpenApi/Extensions/JsonNodeExtension.cs
@@ -5,20 +5,20 @@
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
-namespace Microsoft.OpenApi.Any
+namespace Microsoft.OpenApi.Extensions
{
///
/// A wrapper class for JsonNode
///
- public class OpenApiAny : IOpenApiElement, IOpenApiExtension
+ public class JsonNodeExtension : IOpenApiElement, IOpenApiExtension
{
private readonly JsonNode jsonNode;
///
- /// Initializes the class.
+ /// Initializes the class.
///
///
- public OpenApiAny(JsonNode jsonNode)
+ public JsonNodeExtension(JsonNode jsonNode)
{
this.jsonNode = jsonNode;
}
@@ -29,7 +29,7 @@ public OpenApiAny(JsonNode jsonNode)
public JsonNode Node { get { return jsonNode; } }
///
- /// Writes out the OpenApiAny type.
+ /// Writes out the JsonNodeExtension type.
///
///
///
diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiDeprecationExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiDeprecationExtension.cs
index a61d93ce4..446751799 100644
--- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiDeprecationExtension.cs
+++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiDeprecationExtension.cs
@@ -5,7 +5,6 @@
using System;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
using System.Text.Json.Nodes;
@@ -103,7 +102,7 @@ jsonNode is not JsonValue jsonValue ||
return null;
}
///
- /// Parses the to .
+ /// Parses the to .
///
/// The source object.
/// The .
diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtension.cs
index aabcf0d26..96185ae60 100644
--- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtension.cs
+++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiPrimaryErrorMessageExtension.cs
@@ -5,7 +5,7 @@
using System;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -34,7 +34,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
public bool IsPrimaryErrorMessage { get; set; }
///
- /// Parses the to .
+ /// Parses the to .
///
/// The source object.
/// The .
diff --git a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiReservedParameterExtension.cs b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiReservedParameterExtension.cs
index eb58c1e5c..2b3d22e42 100644
--- a/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiReservedParameterExtension.cs
+++ b/src/Microsoft.OpenApi/MicrosoftExtensions/OpenApiReservedParameterExtension.cs
@@ -5,7 +5,7 @@
using System;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;
@@ -35,7 +35,7 @@ public bool? IsReserved
get; set;
}
///
- /// Parses the to .
+ /// Parses the to .
///
/// The source object.
/// The .
diff --git a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
index 302cfc5ae..7072b2530 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs
@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models.Interfaces;
@@ -110,7 +109,7 @@ public IOpenApiParameter ConvertToBodyParameter(IOpenApiWriter writer)
// Clone extensions so we can remove the x-bodyName extensions from the output V2 model.
if (bodyParameter.Extensions is not null &&
bodyParameter.Extensions.TryGetValue(OpenApiConstants.BodyName, out var bodyNameExtension) &&
- bodyNameExtension is OpenApiAny bodyName)
+ bodyNameExtension is JsonNodeExtension bodyName)
{
bodyParameter.Name = string.IsNullOrEmpty(bodyName.Node.ToString()) ? "body" : bodyName.Node.ToString();
bodyParameter.Extensions.Remove(OpenApiConstants.BodyName);
diff --git a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
index 94d0d9299..efbd3a2eb 100644
--- a/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
+++ b/src/Microsoft.OpenApi/Models/OpenApiSchema.cs
@@ -6,7 +6,6 @@
using System.Linq;
using System.Text.Json;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Helpers;
using Microsoft.OpenApi.Interfaces;
@@ -755,7 +754,7 @@ private void SerializeTypeProperty(JsonSchemaType? type, IOpenApiWriter writer,
var isNullable = (Type.HasValue && Type.Value.HasFlag(JsonSchemaType.Null)) ||
Extensions is not null &&
Extensions.TryGetValue(OpenApiConstants.NullableExtension, out var nullExtRawValue) &&
- nullExtRawValue is OpenApiAny { Node: JsonNode jsonNode } &&
+ nullExtRawValue is JsonNodeExtension { Node: JsonNode jsonNode } &&
jsonNode.GetValueKind() is JsonValueKind.True;
if (type is null)
{
diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs
index 883aa137b..1bbb387dd 100644
--- a/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs
+++ b/src/Microsoft.OpenApi/Reader/ParseNodes/AnyMapFieldMapParameter.cs
@@ -27,7 +27,7 @@ public AnyMapFieldMapParameter(
}
///
- /// Function to retrieve the property that is a map from string to an inner element containing IOpenApiAny.
+ /// Function to retrieve the property that is a map from string to an inner element.
///
public Func?> PropertyMapGetter { get; }
diff --git a/src/Microsoft.OpenApi/Reader/ParseNodes/MapNode.cs b/src/Microsoft.OpenApi/Reader/ParseNodes/MapNode.cs
index ae7adefa6..f16807701 100644
--- a/src/Microsoft.OpenApi/Reader/ParseNodes/MapNode.cs
+++ b/src/Microsoft.OpenApi/Reader/ParseNodes/MapNode.cs
@@ -9,8 +9,8 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
namespace Microsoft.OpenApi.Reader.ParseNodes
@@ -191,7 +191,7 @@ public override string GetRaw()
}
///
- /// Create an
+ /// Create an
///
/// The created Json object.
public override JsonNode CreateAny()
diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs
index 4e53273e8..ebea2bc40 100644
--- a/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs
+++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs
@@ -3,14 +3,12 @@
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Models.Interfaces;
using System;
-using Microsoft.OpenApi.Interfaces;
namespace Microsoft.OpenApi.Reader.V2
{
@@ -242,7 +240,7 @@ internal static IOpenApiRequestBody CreateRequestBody(
if (bodyParameter.Name is not null)
{
requestBody.Extensions ??= [];
- requestBody.Extensions[OpenApiConstants.BodyName] = new OpenApiAny(bodyParameter.Name);
+ requestBody.Extensions[OpenApiConstants.BodyName] = new JsonNodeExtension(bodyParameter.Name);
}
return requestBody;
}
diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiV2Deserializer.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiV2Deserializer.cs
index dc347615e..c791d1f56 100644
--- a/src/Microsoft.OpenApi/Reader/V2/OpenApiV2Deserializer.cs
+++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiV2Deserializer.cs
@@ -5,8 +5,8 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
@@ -86,7 +86,7 @@ private static IOpenApiExtension LoadExtension(string name, ParseNode node)
}
else
{
- return new OpenApiAny(node.CreateAny());
+ return new JsonNodeExtension(node.CreateAny());
}
}
diff --git a/src/Microsoft.OpenApi/Reader/V2/OpenApiV2VersionService.cs b/src/Microsoft.OpenApi/Reader/V2/OpenApiV2VersionService.cs
index ec46036e0..354358ca6 100644
--- a/src/Microsoft.OpenApi/Reader/V2/OpenApiV2VersionService.cs
+++ b/src/Microsoft.OpenApi/Reader/V2/OpenApiV2VersionService.cs
@@ -3,8 +3,8 @@
using System;
using System.Collections.Generic;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Properties;
@@ -31,7 +31,7 @@ public OpenApiV2VersionService(OpenApiDiagnostic diagnostic)
private readonly Dictionary> _loaders = new()
{
- [typeof(OpenApiAny)] = OpenApiV2Deserializer.LoadAny,
+ [typeof(JsonNodeExtension)] = OpenApiV2Deserializer.LoadAny,
[typeof(OpenApiContact)] = OpenApiV2Deserializer.LoadContact,
[typeof(OpenApiExternalDocs)] = OpenApiV2Deserializer.LoadExternalDocs,
[typeof(OpenApiHeader)] = OpenApiV2Deserializer.LoadHeader,
diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs
index 29eb3db70..4049fe0c0 100644
--- a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs
+++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs
@@ -5,9 +5,9 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
using Microsoft.OpenApi.Expressions;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
@@ -131,9 +131,9 @@ private static RuntimeExpressionAnyWrapper LoadRuntimeExpressionAnyWrapper(Parse
};
}
- public static OpenApiAny LoadAny(ParseNode node, OpenApiDocument hostDocument)
+ public static JsonNodeExtension LoadAny(ParseNode node, OpenApiDocument hostDocument)
{
- return new OpenApiAny(node.CreateAny());
+ return new JsonNodeExtension(node.CreateAny());
}
private static IOpenApiExtension LoadExtension(string name, ParseNode node)
@@ -145,7 +145,7 @@ private static IOpenApiExtension LoadExtension(string name, ParseNode node)
}
else
{
- return new OpenApiAny(node.CreateAny());
+ return new JsonNodeExtension(node.CreateAny());
}
}
diff --git a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs
index 34ad86fe3..cfbf30bae 100644
--- a/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs
+++ b/src/Microsoft.OpenApi/Reader/V3/OpenApiV3VersionService.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
@@ -32,7 +32,7 @@ public OpenApiV3VersionService(OpenApiDiagnostic diagnostic)
private readonly Dictionary> _loaders = new()
{
- [typeof(OpenApiAny)] = OpenApiV3Deserializer.LoadAny,
+ [typeof(JsonNodeExtension)] = OpenApiV3Deserializer.LoadAny,
[typeof(OpenApiCallback)] = OpenApiV3Deserializer.LoadCallback,
[typeof(OpenApiComponents)] = OpenApiV3Deserializer.LoadComponents,
[typeof(OpenApiContact)] = OpenApiV3Deserializer.LoadContact,
diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs
index 4ecb26bf7..9b871863f 100644
--- a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs
+++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31Deserializer.cs
@@ -4,9 +4,9 @@
using System;
using System.Linq;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
using Microsoft.OpenApi.Expressions;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
@@ -139,7 +139,7 @@ private static IOpenApiExtension LoadExtension(string name, ParseNode node)
{
return node.Context.ExtensionParsers is not null && node.Context.ExtensionParsers.TryGetValue(name, out var parser)
? parser(node.CreateAny(), OpenApiSpecVersion.OpenApi3_1)
- : new OpenApiAny(node.CreateAny());
+ : new JsonNodeExtension(node.CreateAny());
}
private static string? LoadString(ParseNode node)
diff --git a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31VersionService.cs b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31VersionService.cs
index 90d8e86aa..648fcc93e 100644
--- a/src/Microsoft.OpenApi/Reader/V31/OpenApiV31VersionService.cs
+++ b/src/Microsoft.OpenApi/Reader/V31/OpenApiV31VersionService.cs
@@ -4,7 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
@@ -31,7 +31,7 @@ public OpenApiV31VersionService(OpenApiDiagnostic diagnostic)
private readonly Dictionary> _loaders = new Dictionary>
{
- [typeof(OpenApiAny)] = OpenApiV31Deserializer.LoadAny,
+ [typeof(JsonNodeExtension)] = OpenApiV31Deserializer.LoadAny,
[typeof(OpenApiCallback)] = OpenApiV31Deserializer.LoadCallback,
[typeof(OpenApiComponents)] = OpenApiV31Deserializer.LoadComponents,
[typeof(OpenApiContact)] = OpenApiV31Deserializer.LoadContact,
diff --git a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs
index c0cc15979..56eea541a 100644
--- a/src/Microsoft.OpenApi/Services/OpenApiWalker.cs
+++ b/src/Microsoft.OpenApi/Services/OpenApiWalker.cs
@@ -6,7 +6,6 @@
using System.Linq;
using System.Net.Http;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
@@ -965,7 +964,7 @@ internal void Walk(Dictionary? examples)
}
///
- /// Visits and child objects
+ /// Visits and child objects
///
internal void Walk(JsonNode? example)
{
diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs
index 09ee79309..4e46c5bf1 100644
--- a/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs
+++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterAnyExtensions.cs
@@ -6,13 +6,13 @@
using System.Globalization;
using System.Text.Json;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
namespace Microsoft.OpenApi.Writers
{
///
- /// Extensions methods for writing the
+ /// Extensions methods for writing the
///
public static class OpenApiWriterAnyExtensions
{
diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs
index 7b3cd338e..0e618ba1b 100644
--- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs
+++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs
@@ -1,8 +1,6 @@
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Hidi.Formatters;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Services;
using Xunit;
@@ -147,7 +145,7 @@ private static OpenApiDocument GetSampleOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-operation-type", new OpenApiAny("function")
+ "x-ms-docs-operation-type", new JsonNodeExtension("function")
}
}
}
diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs
index 421cecdd7..3335f6b7f 100644
--- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs
+++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs
@@ -1,8 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-using Microsoft.OpenApi.Any;
-using Microsoft.OpenApi.Interfaces;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
@@ -475,7 +474,7 @@ public static OpenApiDocument CreateOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-key-type", new OpenApiAny("call")
+ "x-ms-docs-key-type", new JsonNodeExtension("call")
}
}
}
@@ -492,7 +491,7 @@ public static OpenApiDocument CreateOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-operation-type", new OpenApiAny("action")
+ "x-ms-docs-operation-type", new JsonNodeExtension("action")
}
}
}
@@ -523,7 +522,7 @@ public static OpenApiDocument CreateOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-key-type", new OpenApiAny("group")
+ "x-ms-docs-key-type", new JsonNodeExtension("group")
}
}
},
@@ -540,7 +539,7 @@ public static OpenApiDocument CreateOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-key-type", new OpenApiAny("event")
+ "x-ms-docs-key-type", new JsonNodeExtension("event")
}
}
}
@@ -579,7 +578,7 @@ public static OpenApiDocument CreateOpenApiDocument()
Extensions = new()
{
{
- "x-ms-docs-operation-type", new OpenApiAny("function")
+ "x-ms-docs-operation-type", new JsonNodeExtension("function")
}
}
}
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs
index d6daa59d8..c557ade80 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs
@@ -9,7 +9,7 @@
using System.Threading.Tasks;
using FluentAssertions;
using FluentAssertions.Equivalency;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
@@ -55,7 +55,7 @@ public void ParseDocumentWithDifferentCultureShouldSucceed(string culture)
"yaml", SettingsFixture.ReaderSettings);
Assert.Equal("0.9.1", result.Document.Info.Version, StringComparer.OrdinalIgnoreCase);
- var extension = Assert.IsType(result.Document.Info.Extensions["x-extension"]);
+ var extension = Assert.IsType(result.Document.Info.Extensions["x-extension"]);
Assert.Equal(2.335M, extension.Node.GetValue());
var sampleSchema = Assert.IsType(result.Document.Components.Schemas["sampleSchema"]);
var samplePropertySchema = Assert.IsType(sampleSchema.Properties["sampleProperty"]);
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiHeaderTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiHeaderTests.cs
index 86ebfcab2..62de886f5 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiHeaderTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiHeaderTests.cs
@@ -4,7 +4,7 @@
using System.IO;
using FluentAssertions;
using FluentAssertions.Equivalency;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Reader.V2;
@@ -38,7 +38,7 @@ public void ParseHeaderWithDefaultShouldSucceed()
{
Type = JsonSchemaType.Number,
Format = "float",
- Default = new OpenApiAny(5).Node
+ Default = new JsonNodeExtension(5).Node
}
},
options => options
@@ -69,9 +69,9 @@ public void ParseHeaderWithEnumShouldSucceed()
Format = "float",
Enum =
[
- new OpenApiAny(7).Node,
- new OpenApiAny(8).Node,
- new OpenApiAny(9).Node
+ new JsonNodeExtension(7).Node,
+ new JsonNodeExtension(8).Node,
+ new JsonNodeExtension(9).Node
]
}
}, options => options.IgnoringCyclicReferences()
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs
index 3d40535c6..811feec75 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiOperationTests.cs
@@ -8,9 +8,7 @@
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using FluentAssertions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
@@ -96,7 +94,7 @@ public class OpenApiOperationTests
},
Extensions = new()
{
- [OpenApiConstants.BodyName] = new OpenApiAny("petObject")
+ [OpenApiConstants.BodyName] = new JsonNodeExtension("petObject")
}
},
Responses = new OpenApiResponses
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs
index 6e8685c4b..30d805c66 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiParameterTests.cs
@@ -4,7 +4,7 @@
using System.IO;
using FluentAssertions;
using FluentAssertions.Equivalency;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Reader.V2;
@@ -239,7 +239,7 @@ public void ParseParameterWithDefaultShouldSucceed()
{
Type = JsonSchemaType.Number,
Format = "float",
- Default = new OpenApiAny(5).Node
+ Default = new JsonNodeExtension(5).Node
}
}, options => options.IgnoringCyclicReferences().Excluding(x => x.Schema.Default.Parent));
}
@@ -268,9 +268,9 @@ public void ParseParameterWithEnumShouldSucceed()
Format = "float",
Enum =
[
- new OpenApiAny(7).Node,
- new OpenApiAny(8).Node,
- new OpenApiAny(9).Node
+ new JsonNodeExtension(7).Node,
+ new JsonNodeExtension(8).Node,
+ new JsonNodeExtension(9).Node
]
}
};
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs
index 68f41271a..b4dfae059 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSchemaTests.cs
@@ -7,7 +7,7 @@
using Xunit;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Models;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using System.Text.Json.Nodes;
using System.Collections.Generic;
using FluentAssertions.Equivalency;
@@ -87,9 +87,9 @@ public void ParseSchemaWithEnumShouldSucceed()
Format = "float",
Enum =
[
- new OpenApiAny(7).Node,
- new OpenApiAny(8).Node,
- new OpenApiAny(9).Node
+ new JsonNodeExtension(7).Node,
+ new JsonNodeExtension(8).Node,
+ new JsonNodeExtension(9).Node
]
};
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs
index fd7c5e478..94bc24012 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs
@@ -7,7 +7,7 @@
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using FluentAssertions;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader;
@@ -39,7 +39,7 @@ public async Task ParseAdvancedInfoShouldSucceed()
Email = "example@example.com",
Extensions = new Dictionary
{
- ["x-twitter"] = new OpenApiAny("@exampleTwitterHandler")
+ ["x-twitter"] = new JsonNodeExtension("@exampleTwitterHandler")
},
Name = "John Doe",
Url = new Uri("http://www.example.com/url1")
@@ -48,36 +48,36 @@ public async Task ParseAdvancedInfoShouldSucceed()
{
Extensions = new Dictionary
{
- ["x-disclaimer"] = new OpenApiAny("Sample Extension String Disclaimer")
+ ["x-disclaimer"] = new JsonNodeExtension("Sample Extension String Disclaimer")
},
Name = "licenseName",
Url = new Uri("http://www.example.com/url2")
},
Extensions = new Dictionary
{
- ["x-something"] = new OpenApiAny("Sample Extension String Something"),
- ["x-contact"] = new OpenApiAny(new JsonObject()
+ ["x-something"] = new JsonNodeExtension("Sample Extension String Something"),
+ ["x-contact"] = new JsonNodeExtension(new JsonObject()
{
["name"] = "John Doe",
["url"] = "http://www.example.com/url3",
["email"] = "example@example.com"
}),
- ["x-list"] = new OpenApiAny (new JsonArray { "1", "2" })
+ ["x-list"] = new JsonNodeExtension (new JsonArray { "1", "2" })
}
}, options => options.IgnoringCyclicReferences()
- .Excluding(i => ((OpenApiAny)i.Contact.Extensions["x-twitter"]).Node.Parent)
- .Excluding(i => ((OpenApiAny)i.License.Extensions["x-disclaimer"]).Node.Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-something"]).Node.Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["name"].Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["name"].Root)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["url"].Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["url"].Root)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["email"].Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-contact"]).Node["email"].Root)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-list"]).Node[0].Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-list"]).Node[0].Root)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-list"]).Node[1].Parent)
- .Excluding(i => ((OpenApiAny)i.Extensions["x-list"]).Node[1].Root));
+ .Excluding(i => ((JsonNodeExtension)i.Contact.Extensions["x-twitter"]).Node.Parent)
+ .Excluding(i => ((JsonNodeExtension)i.License.Extensions["x-disclaimer"]).Node.Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-something"]).Node.Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["name"].Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["name"].Root)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["url"].Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["url"].Root)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["email"].Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-contact"]).Node["email"].Root)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-list"]).Node[0].Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-list"]).Node[0].Root)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-list"]).Node[1].Parent)
+ .Excluding(i => ((JsonNodeExtension)i.Extensions["x-list"]).Node[1].Root));
}
[Fact]
diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs
index d9b4b1901..34cd2f9ca 100644
--- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs
+++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs
@@ -5,7 +5,6 @@
using System.IO;
using System.Text.Json.Nodes;
using FluentAssertions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Extensions;
using SharpYaml.Serialization;
@@ -65,12 +64,12 @@ public void ParseExampleStringFragmentShouldSucceed()
}";
// Act
- var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic, settings: SettingsFixture.ReaderSettings);
+ var jsonNodeExtension = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic, settings: SettingsFixture.ReaderSettings);
// Assert
Assert.Equivalent(new OpenApiDiagnostic(), diagnostic);
- openApiAny.Should().BeEquivalentTo(new OpenApiAny(
+ jsonNodeExtension.Should().BeEquivalentTo(new JsonNodeExtension(
new JsonObject
{
["foo"] = "bar",
@@ -88,12 +87,12 @@ public void ParseEnumFragmentShouldSucceed()
]";
// Act
- var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic, settings: SettingsFixture.ReaderSettings);
+ var jsonNodeExtension = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, new(), out var diagnostic, settings: SettingsFixture.ReaderSettings);
// Assert
Assert.Equivalent(new OpenApiDiagnostic(), diagnostic);
- openApiAny.Should().BeEquivalentTo(new OpenApiAny(
+ jsonNodeExtension.Should().BeEquivalentTo(new JsonNodeExtension(
new JsonArray
{
"foo",
@@ -213,8 +212,8 @@ public void ParseBasicSchemaWithExampleShouldSucceed()
},
Example = new JsonObject
{
- ["name"] = new OpenApiAny("Puma").Node,
- ["id"] = new OpenApiAny(1).Node
+ ["name"] = new JsonNodeExtension("Puma").Node,
+ ["id"] = new JsonNodeExtension(1).Node
}
}, options => options
.IgnoringCyclicReferences()
diff --git a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiDeprecationExtensionTests.cs b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiDeprecationExtensionTests.cs
index f4364d032..ba721cc15 100644
--- a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiDeprecationExtensionTests.cs
+++ b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiDeprecationExtensionTests.cs
@@ -1,7 +1,6 @@
using System;
using System.IO;
using Microsoft.OpenApi.MicrosoftExtensions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Writers;
using Xunit;
using System.Text.Json.Nodes;
diff --git a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPagingExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPagingExtensionsTests.cs
index 3d084908c..e341e5011 100644
--- a/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPagingExtensionsTests.cs
+++ b/test/Microsoft.OpenApi.Tests/MicrosoftExtensions/OpenApiPagingExtensionsTests.cs
@@ -1,10 +1,10 @@
using System;
using System.IO;
using Microsoft.OpenApi.MicrosoftExtensions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Writers;
using Xunit;
using System.Text.Json.Nodes;
+using Microsoft.OpenApi.Extensions;
namespace Microsoft.OpenApi.Tests.MicrosoftExtensions;
@@ -77,9 +77,9 @@ public void ParsesPagingInfo()
// Arrange
var obj = new JsonObject
{
- ["nextLinkName"] = new OpenApiAny("@odata.nextLink").Node,
- ["operationName"] = new OpenApiAny("more").Node,
- ["itemName"] = new OpenApiAny("item").Node,
+ ["nextLinkName"] = new JsonNodeExtension("@odata.nextLink").Node,
+ ["operationName"] = new JsonNodeExtension("more").Node,
+ ["itemName"] = new JsonNodeExtension("item").Node,
};
// Act
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs
index 114956a11..5f729b884 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiContactTests.cs
@@ -1,11 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Xunit;
@@ -23,7 +20,7 @@ public class OpenApiContactTests
Email = "support@example.com",
Extensions = new()
{
- {"x-internal-id", new OpenApiAny(42)}
+ {"x-internal-id", new JsonNodeExtension(42)}
}
};
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
index 48310df15..bbeeaf10f 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs
@@ -7,9 +7,7 @@
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
@@ -973,12 +971,12 @@ public class OpenApiDocumentTests
Type = JsonSchemaType.Integer,
Extensions = new()
{
- ["my-extension"] = new OpenApiAny(4)
+ ["my-extension"] = new JsonNodeExtension(4)
}
},
Extensions = new()
{
- ["my-extension"] = new OpenApiAny(4),
+ ["my-extension"] = new JsonNodeExtension(4),
}
},
new OpenApiParameter
@@ -992,12 +990,12 @@ public class OpenApiDocumentTests
Type = JsonSchemaType.Integer,
Extensions = new()
{
- ["my-extension"] = new OpenApiAny(4)
+ ["my-extension"] = new JsonNodeExtension(4)
}
},
Extensions = new()
{
- ["my-extension"] = new OpenApiAny(4),
+ ["my-extension"] = new JsonNodeExtension(4),
}
},
],
@@ -2079,7 +2077,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks()
Name = "tag1",
Extensions = new()
{
- ["x-tag1"] = new OpenApiAny("tag1")
+ ["x-tag1"] = new JsonNodeExtension("tag1")
}
},
new OpenApiTag
@@ -2087,7 +2085,7 @@ public async Task SerializeDocumentTagsWithMultipleExtensionsWorks()
Name = "tag2",
Extensions = new()
{
- ["x-tag2"] = new OpenApiAny("tag2")
+ ["x-tag2"] = new JsonNodeExtension("tag2")
}
}
}
@@ -2108,7 +2106,7 @@ public void DeduplicatesTags()
Name = "tag1",
Extensions = new()
{
- ["x-tag1"] = new OpenApiAny("tag1")
+ ["x-tag1"] = new JsonNodeExtension("tag1")
}
},
new OpenApiTag
@@ -2116,7 +2114,7 @@ public void DeduplicatesTags()
Name = "tag2",
Extensions = new()
{
- ["x-tag2"] = new OpenApiAny("tag2")
+ ["x-tag2"] = new JsonNodeExtension("tag2")
}
},
new OpenApiTag
@@ -2124,7 +2122,7 @@ public void DeduplicatesTags()
Name = "tag1",
Extensions = new()
{
- ["x-tag1"] = new OpenApiAny("tag1")
+ ["x-tag1"] = new JsonNodeExtension("tag1")
}
}
}
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs
index c78c1d74f..3145ee146 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiInfoTests.cs
@@ -3,9 +3,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Xunit;
@@ -24,7 +22,7 @@ public class OpenApiInfoTests
Version = "1.1.1",
Extensions = new()
{
- {"x-updated", new OpenApiAny("metadata")}
+ {"x-updated", new JsonNodeExtension("metadata")}
}
};
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs
index acad2216a..114ac6945 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLicenseTests.cs
@@ -1,11 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Xunit;
@@ -25,7 +22,7 @@ public class OpenApiLicenseTests
Url = new("http://www.apache.org/licenses/LICENSE-2.0.html"),
Extensions = new()
{
- {"x-copyright", new OpenApiAny("Abc")}
+ {"x-copyright", new JsonNodeExtension("Abc")}
}
};
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs
index 03b406adf..0d1be7130 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.cs
@@ -6,9 +6,8 @@
using System.IO;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Expressions;
-using Microsoft.OpenApi.Interfaces;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Writers;
@@ -128,7 +127,7 @@ public void LinkExtensionsSerializationWorks()
{
Extensions = new()
{
- { "x-display", new OpenApiAny("Abc")
+ { "x-display", new JsonNodeExtension("Abc")
}
}
};
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs
index a9bb4ba78..78eb26f41 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.cs
@@ -4,9 +4,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Text.Json.Nodes;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
@@ -76,8 +74,8 @@ public class OpenApiParameterTests
{
Enum =
[
- new OpenApiAny("value1").Node,
- new OpenApiAny("value2").Node
+ new JsonNodeExtension("value1").Node,
+ new JsonNodeExtension("value2").Node
]
}
}
@@ -97,8 +95,8 @@ public class OpenApiParameterTests
{
Enum =
[
- new OpenApiAny("value1").Node,
- new OpenApiAny("value2").Node
+ new JsonNodeExtension("value1").Node,
+ new JsonNodeExtension("value2").Node
]
}
}
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs
index 4c579fb9e..64a111e9d 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.cs
@@ -5,16 +5,13 @@
using System.Globalization;
using System.IO;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Writers;
using VerifyXunit;
using Xunit;
-using Xunit.Abstractions;
namespace Microsoft.OpenApi.Tests.Models
{
@@ -38,7 +35,7 @@ public class OpenApiResponseTests
Example = "Blabla",
Extensions = new()
{
- ["myextension"] = new OpenApiAny("myextensionvalue"),
+ ["myextension"] = new JsonNodeExtension("myextensionvalue"),
},
}
},
@@ -77,7 +74,7 @@ public class OpenApiResponseTests
Example = "Blabla",
Extensions = new()
{
- ["myextension"] = new OpenApiAny("myextensionvalue"),
+ ["myextension"] = new JsonNodeExtension("myextensionvalue"),
},
}
},
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
index 779a87e3e..82f1ac11b 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.cs
@@ -8,9 +8,7 @@
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using FluentAssertions;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Services;
@@ -538,7 +536,7 @@ public void CloningSchemaExtensionsWorks()
{
Extensions = new()
{
- { "x-myextension", new OpenApiAny(42) }
+ { "x-myextension", new JsonNodeExtension(42) }
}
};
@@ -549,7 +547,7 @@ public void CloningSchemaExtensionsWorks()
// Act && Assert
schemaCopy.Extensions = new()
{
- { "x-myextension" , new OpenApiAny(40) }
+ { "x-myextension" , new JsonNodeExtension(40) }
};
Assert.NotEqual(schema.Extensions, schemaCopy.Extensions);
}
diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs
index 173bf6620..6848d2e3d 100644
--- a/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiXmlTests.cs
@@ -1,11 +1,8 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-using System.Collections.Generic;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Extensions;
-using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Xunit;
@@ -23,7 +20,7 @@ public class OpenApiXmlTests
Attribute = true,
Extensions = new()
{
- {"x-xml-extension", new OpenApiAny(7)}
+ {"x-xml-extension", new JsonNodeExtension(7)}
}
};
diff --git a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
index 1e3c88ec0..080f648c7 100644
--- a/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
+++ b/test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt
@@ -3,15 +3,6 @@
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Microsoft.OpenApi.Readers.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(@"Microsoft.OpenApi.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
-namespace Microsoft.OpenApi.Any
-{
- public class OpenApiAny : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiExtension
- {
- public OpenApiAny(System.Text.Json.Nodes.JsonNode jsonNode) { }
- public System.Text.Json.Nodes.JsonNode Node { get; }
- public void Write(Microsoft.OpenApi.Writers.IOpenApiWriter writer, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { }
- }
-}
namespace Microsoft.OpenApi.Attributes
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)]
@@ -149,6 +140,12 @@ namespace Microsoft.OpenApi.Extensions
where T : System.Attribute { }
public static string GetDisplayName(this System.Enum enumValue) { }
}
+ public class JsonNodeExtension : Microsoft.OpenApi.Interfaces.IOpenApiElement, Microsoft.OpenApi.Interfaces.IOpenApiExtension
+ {
+ public JsonNodeExtension(System.Text.Json.Nodes.JsonNode jsonNode) { }
+ public System.Text.Json.Nodes.JsonNode Node { get; }
+ public void Write(Microsoft.OpenApi.Writers.IOpenApiWriter writer, Microsoft.OpenApi.OpenApiSpecVersion specVersion) { }
+ }
public static class OpenApiElementExtensions
{
public static System.Collections.Generic.IEnumerable Validate(this Microsoft.OpenApi.Interfaces.IOpenApiElement element, Microsoft.OpenApi.Validations.ValidationRuleSet ruleSet) { }
diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs
index 1de888cd3..13f34598b 100644
--- a/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiValidatorTests.cs
@@ -6,7 +6,7 @@
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Properties;
@@ -103,8 +103,8 @@ public void ValidateCustomExtension()
{
var ruleset = ValidationRuleSet.GetDefaultRuleSet();
- ruleset.Add(typeof(OpenApiAny),
- new ValidationRule("FooExtensionRule",
+ ruleset.Add(typeof(JsonNodeExtension),
+ new ValidationRule("FooExtensionRule",
(context, item) =>
{
if (item.Node["Bar"].ToString() == "hey")
@@ -133,7 +133,7 @@ public void ValidateCustomExtension()
var jsonNode = JsonNode.Parse(extensionNode);
openApiDocument.Info.Extensions = new Dictionary
{
- { "x-foo", new OpenApiAny(jsonNode) }
+ { "x-foo", new JsonNodeExtension(jsonNode) }
};
var validator = new OpenApiValidator(ruleset);
@@ -150,8 +150,8 @@ public void ValidateCustomExtension()
[Fact]
public void RemoveRuleByName_Invalid()
{
- Assert.Throws(() => new ValidationRule(null, (vc, oaa) => { }));
- Assert.Throws(() => new ValidationRule(string.Empty, (vc, oaa) => { }));
+ Assert.Throws(() => new ValidationRule(null, (vc, oaa) => { }));
+ Assert.Throws(() => new ValidationRule(string.Empty, (vc, oaa) => { }));
}
[Fact]
diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs
index f0c772473..be2903023 100644
--- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiSchemaValidationTests.cs
@@ -5,7 +5,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Nodes;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Properties;
@@ -75,15 +75,15 @@ public void ValidateEnumShouldNotHaveDataTypeMismatchForSimpleSchema()
{
Enum =
[
- new OpenApiAny("1").Node,
- new OpenApiAny(new JsonObject()
+ new JsonNodeExtension("1").Node,
+ new JsonNodeExtension(new JsonObject()
{
["x"] = 2,
["y"] = "20",
["z"] = "200"
}).Node,
- new OpenApiAny(new JsonArray() { 3 }).Node,
- new OpenApiAny(new JsonObject()
+ new JsonNodeExtension(new JsonArray() { 3 }).Node,
+ new JsonNodeExtension(new JsonObject()
{
["x"] = 4,
["y"] = 40,
diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs
index 9824b17f6..400b83e13 100644
--- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiTagValidationTests.cs
@@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Linq;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Properties;
@@ -44,7 +44,7 @@ public void ValidateExtensionNameStartsWithXDashInTag()
};
tag.Extensions = new Dictionary
{
- { "tagExt", new OpenApiAny("value") }
+ { "tagExt", new JsonNodeExtension("value") }
};
// Act
diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs
index fb149b5ec..d46e69ce6 100644
--- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs
+++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiJsonWriterTests.cs
@@ -10,10 +10,9 @@
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
-using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
-using Microsoft.OpenApi.Any;
+using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Writers;
using Xunit;
@@ -320,9 +319,9 @@ public void OpenApiJsonWriterOutputsValidJsonValueWhenSchemaHasNanOrInfinityValu
{
Enum =
[
- new OpenApiAny("NaN").Node,
- new OpenApiAny("Infinity").Node,
- new OpenApiAny("-Infinity").Node
+ new JsonNodeExtension("NaN").Node,
+ new JsonNodeExtension("Infinity").Node,
+ new JsonNodeExtension("-Infinity").Node
]
};