Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ public interface IOpenApiReferenceHolder<out T, V> : IOpenApiReferenceHolder whe
/// <summary>
/// Gets the resolved target object.
/// </summary>
T Target { get; }
V Target { get; }
/// <summary>
/// Gets the recursively resolved target object.
/// </summary>
T RecursiveTarget { get; }
/// <summary>
/// Copy the reference as a target element with overrides.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the callback object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiCallback : IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiCallback>
public interface IOpenApiCallback : IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiCallback>, IOpenApiReferenceable
{
/// <summary>
/// A Path Item Object used to define a callback request and expected responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the example object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiExample : IOpenApiDescribedElement, IOpenApiSummarizedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiExample>
public interface IOpenApiExample : IOpenApiDescribedElement, IOpenApiSummarizedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiExample>, IOpenApiReferenceable
{
/// <summary>
/// Embedded literal example. The value field and externalValue field are mutually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the headers object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiHeader : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiHeader>
public interface IOpenApiHeader : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiHeader>, IOpenApiReferenceable
{
/// <summary>
/// Determines whether this header is mandatory.
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/Interfaces/IOpenApiLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the link object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiLink : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiLink>
public interface IOpenApiLink : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiLink>, IOpenApiReferenceable
{
/// <summary>
/// A relative or absolute reference to an OAS operation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the parameter object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiParameter>
public interface IOpenApiParameter : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiParameter>, IOpenApiReferenceable
{
/// <summary>
/// REQUIRED. The name of the parameter. Parameter names are case sensitive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the path item object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiPathItem : IOpenApiDescribedElement, IOpenApiSummarizedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiPathItem>
public interface IOpenApiPathItem : IOpenApiDescribedElement, IOpenApiSummarizedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiPathItem>, IOpenApiReferenceable
{
/// <summary>
/// Gets the definition of operations on this path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the request body object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiRequestBody : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiRequestBody>
public interface IOpenApiRequestBody : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiRequestBody>, IOpenApiReferenceable
{
/// <summary>
/// Determines if the request body is required in the request. Defaults to false.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the response object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiResponse>
public interface IOpenApiResponse : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiResponse>, IOpenApiReferenceable
{
/// <summary>
/// Maps a header name to its definition.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the schema object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiSchema>
public interface IOpenApiSchema : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiSchema>, IOpenApiReferenceable
{

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the security scheme object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiSecurityScheme : IOpenApiDescribedElement, IOpenApiSerializable, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiSecurityScheme>
public interface IOpenApiSecurityScheme : IOpenApiDescribedElement, IOpenApiReadOnlyExtensible, IShallowCopyable<IOpenApiSecurityScheme>, IOpenApiReferenceable
{
/// <summary>
/// REQUIRED. The type of the security scheme. Valid values are "apiKey", "http", "oauth2", "openIdConnect".
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/Interfaces/IOpenApiTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Microsoft.OpenApi.Models.Interfaces;
/// Defines the base properties for the path item object.
/// This interface is provided for type assertions but should not be implemented by package consumers beyond automatic mocking.
/// </summary>
public interface IOpenApiTag : IOpenApiSerializable, IOpenApiReadOnlyExtensible, IOpenApiReadOnlyDescribedElement, IShallowCopyable<IOpenApiTag>
public interface IOpenApiTag : IOpenApiReadOnlyExtensible, IOpenApiReadOnlyDescribedElement, IShallowCopyable<IOpenApiTag>, IOpenApiReferenceable
{
/// <summary>
/// The name of the tag.
Expand Down
12 changes: 5 additions & 7 deletions src/Microsoft.OpenApi/Models/OpenApiDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -463,16 +463,14 @@ public void SetReferenceHostDocument()
/// <summary>
/// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
/// </summary>
internal T? ResolveReferenceTo<T>(OpenApiReference reference) where T : class, IOpenApiReferenceable
internal T? ResolveReferenceTo<T>(OpenApiReference reference) where T : IOpenApiReferenceable
{
if (reference.IsExternal)
{
return ResolveReference(reference, true) as T;
}
else

if (ResolveReference(reference, reference.IsExternal) is T result)
{
return ResolveReference(reference, false) as T;
return result;
}
return default;
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Models/OpenApiHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.OpenApi.Models
/// Header Object.
/// The Header Object follows the structure of the Parameter Object.
/// </summary>
public class OpenApiHeader : IOpenApiHeader, IOpenApiReferenceable, IOpenApiExtensible
public class OpenApiHeader : IOpenApiHeader, IOpenApiExtensible
{
/// <inheritdoc/>
public string Description { get; set; }
Expand Down Expand Up @@ -174,7 +174,7 @@ public void SerializeAsV2(IOpenApiWriter writer)

// schema
var targetSchema = Schema switch {
OpenApiSchemaReference schemaReference => schemaReference.Target,
OpenApiSchemaReference schemaReference => schemaReference.RecursiveTarget,
OpenApiSchema schema => schema,
_ => null,
};
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Models/OpenApiParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// <summary>
/// Parameter Object.
/// </summary>
public class OpenApiParameter : IOpenApiReferenceable, IOpenApiExtensible, IOpenApiParameter
public class OpenApiParameter : IOpenApiExtensible, IOpenApiParameter
{
private bool? _explode;
private ParameterStyle? _style;
Expand Down Expand Up @@ -174,11 +174,11 @@
writer.WriteStartObject();

// in
if (this is OpenApiFormDataParameter)

Check warning

Code scanning / CodeQL

Dubious type test of 'this' Warning

Testing whether 'this' is an instance of
OpenApiFormDataParameter
in
OpenApiParameter
introduces a dependency cycle between the two types.
{
writer.WriteProperty(OpenApiConstants.In, "formData");
}
else if (this is OpenApiBodyParameter)

Check warning

Code scanning / CodeQL

Dubious type test of 'this' Warning

Testing whether 'this' is an instance of
OpenApiBodyParameter
in
OpenApiParameter
introduces a dependency cycle between the two types.
{
writer.WriteProperty(OpenApiConstants.In, "body");
}
Expand All @@ -202,7 +202,7 @@
var extensionsClone = new Dictionary<string, IOpenApiExtension>(Extensions);

// schema
if (this is OpenApiBodyParameter)

Check warning

Code scanning / CodeQL

Dubious type test of 'this' Warning

Testing whether 'this' is an instance of
OpenApiBodyParameter
in
OpenApiParameter
introduces a dependency cycle between the two types.
{
writer.WriteOptionalObject(OpenApiConstants.Schema, Schema, (w, s) => s.SerializeAsV2(w));
}
Expand Down Expand Up @@ -232,7 +232,7 @@
// enum
// multipleOf
var targetSchema = Schema switch {
OpenApiSchemaReference schemaReference => schemaReference.Target,
OpenApiSchemaReference schemaReference => schemaReference.RecursiveTarget,
OpenApiSchema schema => schema,
_ => null,
};
Expand Down Expand Up @@ -313,14 +313,14 @@
/// <summary>
/// Body parameter class to propagate information needed for <see cref="OpenApiParameter.SerializeAsV2"/>
/// </summary>
internal class OpenApiBodyParameter : OpenApiParameter

Check warning on line 316 in src/Microsoft.OpenApi/Models/OpenApiParameter.cs

View workflow job for this annotation

GitHub Actions / Build

Remove this empty class, write its code or make it an "interface". (https://rules.sonarsource.com/csharp/RSPEC-2094)
{
}

/// <summary>
/// Form parameter class to propagate information needed for <see cref="OpenApiParameter.SerializeAsV2"/>
/// </summary>
internal class OpenApiFormDataParameter : OpenApiParameter

Check warning on line 323 in src/Microsoft.OpenApi/Models/OpenApiParameter.cs

View workflow job for this annotation

GitHub Actions / Build

Remove this empty class, write its code or make it an "interface". (https://rules.sonarsource.com/csharp/RSPEC-2094)
{
}
}
22 changes: 22 additions & 0 deletions src/Microsoft.OpenApi/Models/OpenApiReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// Licensed under the MIT license.

using System;
using System.Text.Json.Nodes;
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Writers;

namespace Microsoft.OpenApi.Models
Expand Down Expand Up @@ -69,7 +71,7 @@
/// <summary>
/// The OpenApiDocument that is hosting the OpenApiReference instance. This is used to enable dereferencing the reference.
/// </summary>
public OpenApiDocument HostDocument { get => hostDocument; init => hostDocument = value; }

Check warning on line 74 in src/Microsoft.OpenApi/Models/OpenApiReference.cs

View workflow job for this annotation

GitHub Actions / Build

Make this an auto-implemented property and remove its backing field. (https://rules.sonarsource.com/csharp/RSPEC-2292)

/// <summary>
/// Gets the full reference string for v3.0.
Expand All @@ -85,7 +87,7 @@

if (!Type.HasValue)
{
throw new ArgumentNullException(nameof(Type));

Check warning on line 90 in src/Microsoft.OpenApi/Models/OpenApiReference.cs

View workflow job for this annotation

GitHub Actions / Build

The parameter name 'Type' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)

Check warning on line 90 in src/Microsoft.OpenApi/Models/OpenApiReference.cs

View workflow job for this annotation

GitHub Actions / Build

Remove the exception throwing from this property getter, or refactor the property into a method. (https://rules.sonarsource.com/csharp/RSPEC-2372)
}

if (Type == ReferenceType.Tag)
Expand Down Expand Up @@ -121,7 +123,7 @@

if (!Type.HasValue)
{
throw new ArgumentNullException(nameof(Type));

Check warning on line 126 in src/Microsoft.OpenApi/Models/OpenApiReference.cs

View workflow job for this annotation

GitHub Actions / Build

The parameter name 'Type' is not declared in the argument list. (https://rules.sonarsource.com/csharp/RSPEC-3928)

Check warning on line 126 in src/Microsoft.OpenApi/Models/OpenApiReference.cs

View workflow job for this annotation

GitHub Actions / Build

Remove the exception throwing from this property getter, or refactor the property into a method. (https://rules.sonarsource.com/csharp/RSPEC-2372)
}

if (Type == ReferenceType.Tag)
Expand Down Expand Up @@ -292,5 +294,25 @@
Utils.CheckArgumentNull(currentDocument);
hostDocument ??= currentDocument;
}
#nullable enable
private static string? GetPropertyValueFromNode(JsonObject jsonObject, string key) =>
jsonObject.TryGetPropertyValue(key, out var valueNode) && valueNode is JsonValue valueCast && valueCast.TryGetValue<string>(out var strValue) ? strValue : null;
#nullable restore
internal void SetSummaryAndDescriptionFromMapNode(MapNode mapNode)
{
var (description, summary) = mapNode.JsonNode switch {
JsonObject jsonObject => (GetPropertyValueFromNode(jsonObject, OpenApiConstants.Description),
GetPropertyValueFromNode(jsonObject, OpenApiConstants.Summary)),
_ => (null, null)
};
if (!string.IsNullOrEmpty(description))
{
Description = description;
}
if (!string.IsNullOrEmpty(summary))
{
Summary = summary;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Models/OpenApiSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/// <summary>
/// The Schema Object allows the definition of input and output data types.
/// </summary>
public class OpenApiSchema : IOpenApiReferenceable, IOpenApiExtensible, IOpenApiSchema
public class OpenApiSchema : IOpenApiExtensible, IOpenApiSchema
{
/// <inheritdoc />
public string Title { get; set; }
Expand Down Expand Up @@ -265,7 +265,7 @@
/// Initializes a copy of <see cref="IOpenApiSchema"/> object
/// </summary>
/// <param name="schema">The schema object to copy from.</param>
internal OpenApiSchema(IOpenApiSchema schema)

Check warning on line 268 in src/Microsoft.OpenApi/Models/OpenApiSchema.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this constructor to reduce its Cognitive Complexity from 20 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{
Utils.CheckArgumentNull(schema);
Title = schema.Title ?? Title;
Expand Down Expand Up @@ -337,7 +337,7 @@
SerializeInternal(writer, OpenApiSpecVersion.OpenApi3_0, (writer, element) => element.SerializeAsV3(writer));
}

private static void SerializeBounds(IOpenApiWriter writer, OpenApiSpecVersion version, string propertyName, string exclusivePropertyName, string isExclusivePropertyName, decimal? value, decimal? exclusiveValue, bool? isExclusiveValue)

Check warning on line 340 in src/Microsoft.OpenApi/Models/OpenApiSchema.cs

View workflow job for this annotation

GitHub Actions / Build

Method has 8 parameters, which is greater than the 7 authorized. (https://rules.sonarsource.com/csharp/RSPEC-107)
{
if (version >= OpenApiSpecVersion.OpenApi3_1)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Writers;

Expand All @@ -8,14 +8,27 @@ namespace Microsoft.OpenApi.Models.References;
/// </summary>
/// <typeparam name="T">The concrete class implementation type for the model.</typeparam>
/// <typeparam name="V">The interface type for the model.</typeparam>
public abstract class BaseOpenApiReferenceHolder<T, V> : IOpenApiReferenceHolder<T, V> where T : class, IOpenApiReferenceable, V where V : IOpenApiSerializable
public abstract class BaseOpenApiReferenceHolder<T, V> : IOpenApiReferenceHolder<T, V> where T : class, IOpenApiReferenceable, V where V : IOpenApiReferenceable, IOpenApiSerializable
{
/// <inheritdoc/>
public virtual T Target
public virtual V Target
{
get
{
return Reference.HostDocument?.ResolveReferenceTo<T>(Reference);
if (Reference.HostDocument is null) return default;
return Reference.HostDocument.ResolveReferenceTo<V>(Reference);
}
}
/// <inheritdoc/>
public T RecursiveTarget
{
get
{
return Target switch {
BaseOpenApiReferenceHolder<T, V> recursiveTarget => recursiveTarget.RecursiveTarget,
T concrete => concrete,
_ => null
};
}
}
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public string Description
/// <inheritdoc/>
public override void SerializeAsV31(IOpenApiWriter writer)
{
SerializeAsWithoutLoops(writer, (w, element) => (element is IOpenApiSchema s ? CopyReferenceAsTargetElementWithOverrides(s) : element).SerializeAsV3(w));
SerializeAsWithoutLoops(writer, (w, element) => (element is IOpenApiSchema s ? CopyReferenceAsTargetElementWithOverrides(s) : element).SerializeAsV31(w));
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class OpenApiTagReference : BaseOpenApiReferenceHolder<OpenApiTag, IOpenA
/// <summary>
/// Resolved target of the reference.
/// </summary>
public override OpenApiTag Target
public override IOpenApiTag Target
{
get
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,9 @@ public static IOpenApiSchema LoadSchema(ParseNode node, OpenApiDocument hostDocu
if (pointer != null)
{
var reference = GetReferenceIdAndExternalResource(pointer);
return new OpenApiSchemaReference(reference.Item1, hostDocument, reference.Item2);
var result = new OpenApiSchemaReference(reference.Item1, hostDocument, reference.Item2);
result.Reference.SetSummaryAndDescriptionFromMapNode(mapNode);
return result;
}

var schema = new OpenApiSchema();
Expand Down
20 changes: 10 additions & 10 deletions src/Microsoft.OpenApi/Services/CopyReferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public OpenApiComponents Components = new();

/// <inheritdoc/>
public override void Visit(IOpenApiReferenceHolder referenceHolder)

Check warning on line 17 in src/Microsoft.OpenApi/Services/CopyReferences.cs

View workflow job for this annotation

GitHub Actions / Build

All 'Visit' method overloads should be adjacent. (https://rules.sonarsource.com/csharp/RSPEC-4136)
{
switch (referenceHolder)
{
Expand Down Expand Up @@ -85,7 +85,7 @@
base.Visit(referenceHolder);
}

private void AddSchemaToComponents(OpenApiSchema schema, string referenceId = null)
private void AddSchemaToComponents(IOpenApiSchema schema, string referenceId = null)
{
EnsureComponentsExist();
EnsureSchemasExist();
Expand All @@ -95,7 +95,7 @@
}
}

private void AddParameterToComponents(OpenApiParameter parameter, string referenceId = null)
private void AddParameterToComponents(IOpenApiParameter parameter, string referenceId = null)
{
EnsureComponentsExist();
EnsureParametersExist();
Expand All @@ -105,7 +105,7 @@
}
}

private void AddResponseToComponents(OpenApiResponse response, string referenceId = null)
private void AddResponseToComponents(IOpenApiResponse response, string referenceId = null)
{
EnsureComponentsExist();
EnsureResponsesExist();
Expand All @@ -114,7 +114,7 @@
Components.Responses.Add(referenceId, response);
}
}
private void AddRequestBodyToComponents(OpenApiRequestBody requestBody, string referenceId = null)
private void AddRequestBodyToComponents(IOpenApiRequestBody requestBody, string referenceId = null)
{
EnsureComponentsExist();
EnsureRequestBodiesExist();
Expand All @@ -123,7 +123,7 @@
Components.RequestBodies.Add(referenceId, requestBody);
}
}
private void AddLinkToComponents(OpenApiLink link, string referenceId = null)
private void AddLinkToComponents(IOpenApiLink link, string referenceId = null)
{
EnsureComponentsExist();
EnsureLinksExist();
Expand All @@ -132,7 +132,7 @@
Components.Links.Add(referenceId, link);
}
}
private void AddCallbackToComponents(OpenApiCallback callback, string referenceId = null)
private void AddCallbackToComponents(IOpenApiCallback callback, string referenceId = null)
{
EnsureComponentsExist();
EnsureCallbacksExist();
Expand All @@ -141,7 +141,7 @@
Components.Callbacks.Add(referenceId, callback);
}
}
private void AddHeaderToComponents(OpenApiHeader header, string referenceId = null)
private void AddHeaderToComponents(IOpenApiHeader header, string referenceId = null)
{
EnsureComponentsExist();
EnsureHeadersExist();
Expand All @@ -150,7 +150,7 @@
Components.Headers.Add(referenceId, header);
}
}
private void AddExampleToComponents(OpenApiExample example, string referenceId = null)
private void AddExampleToComponents(IOpenApiExample example, string referenceId = null)
{
EnsureComponentsExist();
EnsureExamplesExist();
Expand All @@ -159,7 +159,7 @@
Components.Examples.Add(referenceId, example);
}
}
private void AddPathItemToComponents(OpenApiPathItem pathItem, string referenceId = null)
private void AddPathItemToComponents(IOpenApiPathItem pathItem, string referenceId = null)
{
EnsureComponentsExist();
EnsurePathItemsExist();
Expand All @@ -168,7 +168,7 @@
Components.PathItems.Add(referenceId, pathItem);
}
}
private void AddSecuritySchemeToComponents(OpenApiSecurityScheme securityScheme, string referenceId = null)
private void AddSecuritySchemeToComponents(IOpenApiSecurityScheme securityScheme, string referenceId = null)
{
EnsureComponentsExist();
EnsureSecuritySchemesExist();
Expand Down
Loading
Loading