Skip to content

Commit 68df31b

Browse files
authored
Merge pull request #2152 from dldl-cmd/remove_reference_resolution_parameter
Remove unused ReferenceResolution parameter from OpenApiReaderSettings
2 parents 911b191 + a460489 commit 68df31b

File tree

4 files changed

+3
-49
lines changed

4 files changed

+3
-49
lines changed

src/Microsoft.OpenApi.Workbench/MainModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ internal async Task ParseDocumentAsync()
236236

237237
var settings = new OpenApiReaderSettings
238238
{
239-
ReferenceResolution = ResolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences,
240239
RuleSet = ValidationRuleSet.GetDefaultRuleSet()
241240
};
242241
if (ResolveExternal && !string.IsNullOrWhiteSpace(_inputFile))

src/Microsoft.OpenApi/Reader/OpenApiReaderSettings.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,11 @@
1111

1212
namespace Microsoft.OpenApi.Reader
1313
{
14-
/// <summary>
15-
/// Indicates if and when the reader should convert unresolved references into resolved objects
16-
/// </summary>
17-
public enum ReferenceResolutionSetting
18-
{
19-
/// <summary>
20-
/// Create placeholder objects with an OpenApiReference instance and UnresolvedReference set to true.
21-
/// </summary>
22-
DoNotResolveReferences,
23-
/// <summary>
24-
/// Convert local references to references of valid domain objects.
25-
/// </summary>
26-
ResolveLocalReferences,
27-
/// <summary>
28-
/// ResolveAllReferences effectively means load external references. Will be removed in v2. External references are never "resolved".
29-
/// </summary>
30-
ResolveAllReferences
31-
}
32-
3314
/// <summary>
3415
/// Configuration settings to control how OpenAPI documents are parsed
3516
/// </summary>
3617
public class OpenApiReaderSettings
3718
{
38-
/// <summary>
39-
/// Indicates how references in the source document should be handled.
40-
/// </summary>
41-
/// <remarks>This setting will be going away in the next major version of this library. Use GetEffective on model objects to get resolved references.</remarks>
42-
public ReferenceResolutionSetting ReferenceResolution { get; set; } = ReferenceResolutionSetting.ResolveLocalReferences;
43-
4419
/// <summary>
4520
/// When external references are found, load them into a shared workspace
4621
/// </summary>

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,12 +1134,7 @@ public async Task HeaderParameterShouldAllowExample()
11341134
public async Task ParseDocumentWithReferencedSecuritySchemeWorks()
11351135
{
11361136
// Act
1137-
var settings = new OpenApiReaderSettings
1138-
{
1139-
ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences
1140-
};
1141-
1142-
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "docWithSecuritySchemeReference.yaml"), settings);
1137+
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "docWithSecuritySchemeReference.yaml"));
11431138
var securityScheme = result.Document.Components.SecuritySchemes["OAuth2"];
11441139

11451140
// Assert
@@ -1153,11 +1148,7 @@ public async Task ParseDocumentWithJsonSchemaReferencesWorks()
11531148
using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "docWithJsonSchema.yaml"));
11541149

11551150
// Act
1156-
var settings = new OpenApiReaderSettings
1157-
{
1158-
ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences
1159-
};
1160-
var result = await OpenApiDocument.LoadAsync(stream, OpenApiConstants.Yaml, settings);
1151+
var result = await OpenApiDocument.LoadAsync(stream, OpenApiConstants.Yaml);
11611152

11621153
var actualSchema = result.Document.Paths["/users/{userId}"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema;
11631154

@@ -1170,11 +1161,7 @@ public async Task ParseDocumentWithJsonSchemaReferencesWorks()
11701161
public async Task ValidateExampleShouldNotHaveDataTypeMismatch()
11711162
{
11721163
// Act
1173-
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "documentWithDateExampleInSchema.yaml"), new OpenApiReaderSettings
1174-
{
1175-
ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences
1176-
1177-
});
1164+
var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "documentWithDateExampleInSchema.yaml"));
11781165

11791166
// Assert
11801167
var warnings = result.Diagnostic.Warnings;

test/Microsoft.OpenApi.Tests/PublicApi/PublicApi.approved.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,6 @@ namespace Microsoft.OpenApi.Reader
15001500
public System.Collections.Generic.Dictionary<string, System.Func<System.Text.Json.Nodes.JsonNode, Microsoft.OpenApi.OpenApiSpecVersion, Microsoft.OpenApi.Interfaces.IOpenApiExtension>> ExtensionParsers { get; set; }
15011501
public bool LeaveStreamOpen { get; set; }
15021502
public bool LoadExternalRefs { get; set; }
1503-
public Microsoft.OpenApi.Reader.ReferenceResolutionSetting ReferenceResolution { get; set; }
15041503
public Microsoft.OpenApi.Validations.ValidationRuleSet RuleSet { get; set; }
15051504
public void AddMicrosoftExtensionParsers() { }
15061505
}
@@ -1535,12 +1534,6 @@ namespace Microsoft.OpenApi.Reader
15351534
public Microsoft.OpenApi.Models.OpenApiDocument Document { get; set; }
15361535
public void Deconstruct(out Microsoft.OpenApi.Models.OpenApiDocument document, out Microsoft.OpenApi.Reader.OpenApiDiagnostic diagnostic) { }
15371536
}
1538-
public enum ReferenceResolutionSetting
1539-
{
1540-
DoNotResolveReferences = 0,
1541-
ResolveLocalReferences = 1,
1542-
ResolveAllReferences = 2,
1543-
}
15441537
}
15451538
namespace Microsoft.OpenApi.Reader.ParseNodes
15461539
{

0 commit comments

Comments
 (0)