diff --git a/examples/WireMock.Net.OpenApiParser.ConsoleApp/WireMock.Net.OpenApiParser.ConsoleApp.csproj b/examples/WireMock.Net.OpenApiParser.ConsoleApp/WireMock.Net.OpenApiParser.ConsoleApp.csproj
index e35ba9fd..310ef063 100644
--- a/examples/WireMock.Net.OpenApiParser.ConsoleApp/WireMock.Net.OpenApiParser.ConsoleApp.csproj
+++ b/examples/WireMock.Net.OpenApiParser.ConsoleApp/WireMock.Net.OpenApiParser.ConsoleApp.csproj
@@ -6,15 +6,13 @@
-
-
-
+
diff --git a/src/WireMock.Net.OpenApiParser/Extensions/DictionaryExtensions.cs b/src/WireMock.Net.OpenApiParser/Extensions/DictionaryExtensions.cs
index aec4ac2f..5a5ea0b8 100644
--- a/src/WireMock.Net.OpenApiParser/Extensions/DictionaryExtensions.cs
+++ b/src/WireMock.Net.OpenApiParser/Extensions/DictionaryExtensions.cs
@@ -1,8 +1,5 @@
// Copyright © WireMock.Net
-
-using System.Diagnostics.CodeAnalysis;
-
namespace System.Collections.Generic;
internal static class DictionaryExtensions
diff --git a/src/WireMock.Net.OpenApiParser/Extensions/WireMockServerExtensions.cs b/src/WireMock.Net.OpenApiParser/Extensions/WireMockServerExtensions.cs
index 7e763b55..bde12912 100644
--- a/src/WireMock.Net.OpenApiParser/Extensions/WireMockServerExtensions.cs
+++ b/src/WireMock.Net.OpenApiParser/Extensions/WireMockServerExtensions.cs
@@ -1,8 +1,8 @@
// Copyright © WireMock.Net
using JetBrains.Annotations;
-using Microsoft.OpenApi.Reader;
using Stef.Validation;
+using WireMock.Net.OpenApiParser.Models;
using WireMock.Net.OpenApiParser.Settings;
using WireMock.Server;
diff --git a/src/WireMock.Net.OpenApiParser/ILRepack.targets b/src/WireMock.Net.OpenApiParser/ILRepack.targets
new file mode 100644
index 00000000..71bd22d4
--- /dev/null
+++ b/src/WireMock.Net.OpenApiParser/ILRepack.targets
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/IWireMockOpenApiParser.cs b/src/WireMock.Net.OpenApiParser/IWireMockOpenApiParser.cs
index 7c451558..c09fa6e7 100644
--- a/src/WireMock.Net.OpenApiParser/IWireMockOpenApiParser.cs
+++ b/src/WireMock.Net.OpenApiParser/IWireMockOpenApiParser.cs
@@ -1,7 +1,7 @@
// Copyright © WireMock.Net
-using Microsoft.OpenApi.Reader;
using WireMock.Admin.Mappings;
+using WireMock.Net.OpenApiParser.Models;
using WireMock.Net.OpenApiParser.Settings;
namespace WireMock.Net.OpenApiParser;
diff --git a/src/WireMock.Net.OpenApiParser/Models/OpenApiDiagnostic.cs b/src/WireMock.Net.OpenApiParser/Models/OpenApiDiagnostic.cs
new file mode 100644
index 00000000..22093244
--- /dev/null
+++ b/src/WireMock.Net.OpenApiParser/Models/OpenApiDiagnostic.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+namespace WireMock.Net.OpenApiParser.Models;
+
+///
+/// Object containing all diagnostic information related to Open API parsing.
+///
+public class OpenApiDiagnostic
+{
+ ///
+ /// List of all errors.
+ ///
+ public List Errors { get; set; } = [];
+
+ ///
+ /// List of all warnings
+ ///
+ public List Warnings { get; set; } = [];
+
+ ///
+ /// Open API specification version of the document parsed.
+ ///
+ public OpenApiSpecVersion SpecificationVersion { get; set; }
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/Models/OpenApiError.cs b/src/WireMock.Net.OpenApiParser/Models/OpenApiError.cs
new file mode 100644
index 00000000..b3d8bbe0
--- /dev/null
+++ b/src/WireMock.Net.OpenApiParser/Models/OpenApiError.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+namespace WireMock.Net.OpenApiParser.Models;
+
+///
+/// Error related to the Open API Document.
+///
+public class OpenApiError
+{
+ ///
+ /// Initializes the class.
+ ///
+ public OpenApiError(string? pointer, string message)
+ {
+ Pointer = pointer;
+ Message = message;
+ }
+
+ ///
+ /// Initializes a copy of an object
+ ///
+ public OpenApiError(OpenApiError error)
+ {
+ Pointer = error.Pointer;
+ Message = error.Message;
+ }
+
+ ///
+ /// Message explaining the error.
+ ///
+ public string Message { get; set; }
+
+ ///
+ /// Pointer to the location of the error.
+ ///
+ public string? Pointer { get; set; }
+
+ ///
+ /// Gets the string representation of .
+ ///
+ public override string ToString()
+ {
+ return Message + (!string.IsNullOrEmpty(Pointer) ? " [" + Pointer + "]" : "");
+ }
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/Models/OpenApiMapper.cs b/src/WireMock.Net.OpenApiParser/Models/OpenApiMapper.cs
new file mode 100644
index 00000000..b203c7f1
--- /dev/null
+++ b/src/WireMock.Net.OpenApiParser/Models/OpenApiMapper.cs
@@ -0,0 +1,23 @@
+// Copyright © WireMock.Net
+
+using MicrosoftOpenApiDiagnostic = Microsoft.OpenApi.Reader.OpenApiDiagnostic;
+
+namespace WireMock.Net.OpenApiParser.Models;
+
+internal static class OpenApiMapper
+{
+ internal static OpenApiDiagnostic? Map(MicrosoftOpenApiDiagnostic? openApiDiagnostic)
+ {
+ if (openApiDiagnostic == null)
+ {
+ return null;
+ }
+
+ return new OpenApiDiagnostic
+ {
+ Errors = openApiDiagnostic.Errors.Select(e => new OpenApiError(e.Pointer, e.Message)).ToList(),
+ Warnings = openApiDiagnostic.Warnings.Select(e => new OpenApiError(e.Pointer, e.Message)).ToList(),
+ SpecificationVersion = (OpenApiSpecVersion)openApiDiagnostic.SpecificationVersion
+ };
+ }
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/Models/OpenApiSpecVersion.cs b/src/WireMock.Net.OpenApiParser/Models/OpenApiSpecVersion.cs
new file mode 100644
index 00000000..31433dd4
--- /dev/null
+++ b/src/WireMock.Net.OpenApiParser/Models/OpenApiSpecVersion.cs
@@ -0,0 +1,29 @@
+// Copyright © WireMock.Net
+
+namespace WireMock.Net.OpenApiParser.Models;
+
+///
+/// Represents versions of OpenAPI specification.
+///
+public enum OpenApiSpecVersion
+{
+ ///
+ /// Represents OpenAPI V2.0 spec
+ ///
+ OpenApi2_0,
+
+ ///
+ /// Represents all patches of OpenAPI V3.0 spec (e.g. 3.0.0, 3.0.1)
+ ///
+ OpenApi3_0,
+
+ ///
+ /// Represents OpenAPI V3.1 spec
+ ///
+ OpenApi3_1,
+
+ ///
+ /// Represents OpenAPI V3.2 spec
+ ///
+ OpenApi3_2
+}
\ No newline at end of file
diff --git a/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
index 6c3b3953..68946953 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/IWireMockOpenApiParserExampleValues.cs
@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
-using System;
using Microsoft.OpenApi;
namespace WireMock.Net.OpenApiParser.Settings;
diff --git a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
index 0f27bf31..26ce5719 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserDynamicExampleValues.cs
@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
-using System;
using Microsoft.OpenApi;
using RandomDataGenerator.FieldOptions;
using RandomDataGenerator.Randomizers;
diff --git a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
index 5acec53a..132d86e1 100644
--- a/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
+++ b/src/WireMock.Net.OpenApiParser/Settings/WireMockOpenApiParserExampleValues.cs
@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
-using System;
using Microsoft.OpenApi;
namespace WireMock.Net.OpenApiParser.Settings;
diff --git a/src/WireMock.Net.OpenApiParser/Utils/DateTimeUtils.cs b/src/WireMock.Net.OpenApiParser/Utils/DateTimeUtils.cs
index e3178549..40ac3380 100644
--- a/src/WireMock.Net.OpenApiParser/Utils/DateTimeUtils.cs
+++ b/src/WireMock.Net.OpenApiParser/Utils/DateTimeUtils.cs
@@ -1,6 +1,5 @@
// Copyright © WireMock.Net
-using System;
using System.Globalization;
namespace WireMock.Net.OpenApiParser.Utils;
diff --git a/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs b/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
index 1ee9920f..6a09e874 100644
--- a/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
+++ b/src/WireMock.Net.OpenApiParser/Utils/ExampleValueGenerator.cs
@@ -1,7 +1,5 @@
// Copyright © WireMock.Net
-using System;
-using System.Linq;
using System.Text.Json.Nodes;
using Microsoft.OpenApi;
using Stef.Validation;
diff --git a/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj b/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
index 3a603126..14cffae4 100644
--- a/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
+++ b/src/WireMock.Net.OpenApiParser/WireMock.Net.OpenApiParser.csproj
@@ -23,7 +23,7 @@
true
-
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
@@ -40,11 +40,27 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs b/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
index 5d675ef3..379f6576 100644
--- a/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
+++ b/src/WireMock.Net.OpenApiParser/WireMockOpenApiParser.cs
@@ -9,7 +9,9 @@ using Microsoft.OpenApi.YamlReader;
using RamlToOpenApiConverter;
using WireMock.Admin.Mappings;
using WireMock.Net.OpenApiParser.Mappers;
+using WireMock.Net.OpenApiParser.Models;
using WireMock.Net.OpenApiParser.Settings;
+using OpenApiDiagnostic = WireMock.Net.OpenApiParser.Models.OpenApiDiagnostic;
namespace WireMock.Net.OpenApiParser;
@@ -125,7 +127,7 @@ public class WireMockOpenApiParser : IWireMockOpenApiParser
var result = OpenApiDocument.Load(memoryStream, settings: _readerSettings);
- diagnostic = result.Diagnostic ?? new OpenApiDiagnostic();
+ diagnostic = OpenApiMapper.Map(result.Diagnostic) ?? new OpenApiDiagnostic();
openApiDocument = result.Document;
return openApiDocument != null && !diagnostic.Errors.Any();
}