Skip to content

Commit ca19f45

Browse files
committed
code cleanup
1 parent b79e374 commit ca19f45

File tree

4 files changed

+3
-21
lines changed

4 files changed

+3
-21
lines changed

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

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

44
using System;
@@ -464,14 +464,6 @@ internal T ResolveReferenceTo<T>(OpenApiReference reference) where T : class, IO
464464
}
465465
}
466466

467-
/// <summary>
468-
/// Load the referenced <see cref="IOpenApiReferenceable"/> object from a <see cref="OpenApiReference"/> object
469-
/// </summary>
470-
public IOpenApiReferenceable ResolveReference(OpenApiReference reference)
471-
{
472-
return ResolveReference(reference, false);
473-
}
474-
475467
/// <summary>
476468
/// Takes in an OpenApi document instance and generates its hash value
477469
/// </summary>

src/Microsoft.OpenApi/Models/OpenApiParameter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public void SerializeAsV2WithoutReference(IOpenApiWriter writer)
327327
}
328328
// In V2 parameter's type can't be a reference to a custom object schema or can't be of type object
329329
// So in that case map the type as string.
330-
else if (Schema?.UnresolvedReference == true || "object".Equals(Schema?.Type.ToString(), StringComparison.OrdinalIgnoreCase))
330+
else if (Schema?.UnresolvedReference == true || "object".Equals(Schema?.Type?.ToString(), StringComparison.OrdinalIgnoreCase))
331331
{
332332
writer.WriteProperty(OpenApiConstants.Type, "string");
333333
}

src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,6 @@ private void SerializeInternal(IOpenApiWriter writer, Action<IOpenApiWriter, IOp
9292
action(writer, target);
9393
}
9494

95-
/// <summary>
96-
/// Returns an effective OpenApiRequestBody object based on the presence of a $ref
97-
/// </summary>
98-
/// <param name="doc">The host OpenApiDocument that contains the reference.</param>
99-
/// <returns>OpenApiRequestBody</returns>
100-
public OpenApiRequestBody GetEffective(OpenApiDocument doc)
101-
{
102-
return Reference != null ? doc.ResolveReferenceTo<OpenApiRequestBody>(Reference) : this;
103-
}
104-
10595
/// <summary>
10696
/// Serialize to OpenAPI V31 document without using reference.
10797
/// </summary>

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ public void SerializeInternalWithoutReference(IOpenApiWriter writer, OpenApiSpec
495495
writer.WriteOptionalCollection(OpenApiConstants.Enum, Enum, (nodeWriter, s) => nodeWriter.WriteAny(new OpenApiAny(s)));
496496

497497
// type
498-
if (Type.GetType() == typeof(string))
498+
if (Type?.GetType() == typeof(string))
499499
{
500500
writer.WriteProperty(OpenApiConstants.Type, (string)Type);
501501
}

0 commit comments

Comments
 (0)