Skip to content

Commit e5f64cb

Browse files
committed
Clean up
1 parent d88e18c commit e5f64cb

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

src/Microsoft.OpenApi.Readers/ParsingContext.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,12 @@ namespace Microsoft.OpenApi.Readers
2222
public class ParsingContext
2323
{
2424
private readonly Stack<string> _currentLocation = new Stack<string>();
25-
2625
private readonly Dictionary<string, object> _tempStorage = new Dictionary<string, object>();
2726
private IOpenApiVersionService _versionService;
2827
private readonly Dictionary<string, Stack<string>> _loopStacks = new Dictionary<string, Stack<string>>();
2928
internal Dictionary<string, Func<IOpenApiAny, IOpenApiExtension>> ExtensionParsers { get; set; } = new Dictionary<string, Func<IOpenApiAny, IOpenApiExtension>>();
3029
internal RootNode RootNode { get; set; }
3130
internal List<OpenApiTag> Tags { get; private set; } = new List<OpenApiTag>();
32-
3331

3432
/// <summary>
3533
/// Initiates the parsing process. Not thread safe and should only be called once on a parsing context

src/Microsoft.OpenApi.Readers/Services/OpenApiReferenceResolver.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public override void Visit(OpenApiComponents components)
4444
ResolveMap(components.SecuritySchemes);
4545
}
4646

47-
4847
public override void Visit(IDictionary<string, OpenApiCallback> callbacks)
4948
{
5049
ResolveMap(callbacks);
@@ -173,7 +172,6 @@ private void ResolveTags(IList<OpenApiTag> tags)
173172
}
174173
}
175174

176-
177175
private T ResolveReference<T>(OpenApiReference reference) where T : class, IOpenApiReferenceable, new()
178176
{
179177
if (string.IsNullOrEmpty(reference.ExternalResource))

src/Microsoft.OpenApi/Models/OpenApiDocument.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,6 @@ private static void WriteHostInfoV2(IOpenApiWriter writer, IList<OpenApiServer>
271271
/// </summary>
272272
public IOpenApiReferenceable ResolveReference(OpenApiReference reference)
273273
{
274-
275274
if (reference == null)
276275
{
277276
return null;
@@ -335,15 +334,12 @@ public IOpenApiReferenceable ResolveReference(OpenApiReference reference)
335334
return this.Components.Callbacks[reference.Id];
336335

337336
default:
338-
// TODO: Create resource
339-
throw new OpenApiException("Invalid Reference type");
337+
throw new OpenApiException(Properties.SRResource.InvalidReferenceType);
340338
}
341339
} catch(KeyNotFoundException)
342340
{
343-
throw new OpenApiException("Invalid Reference id");
341+
throw new OpenApiException(string.Format(Properties.SRResource.InvalidReferenceId,reference.Id));
344342
}
345-
346343
}
347-
348344
}
349345
}

src/Microsoft.OpenApi/Properties/SRResource.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Microsoft.OpenApi/Properties/SRResource.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@
132132
<data name="InputItemShouldBeType" xml:space="preserve">
133133
<value>The input item should be in type of '{0}'.</value>
134134
</data>
135+
<data name="InvalidReferenceId" xml:space="preserve">
136+
<value>Invalid Reference identifier '{0}'.</value>
137+
</data>
138+
<data name="InvalidReferenceType" xml:space="preserve">
139+
<value>Invalid Reference Type.</value>
140+
</data>
135141
<data name="ObjectScopeNeededForPropertyNameWriting" xml:space="preserve">
136142
<value>The active scope must be an object scope for property name '{0}' to be written.</value>
137143
</data>

0 commit comments

Comments
 (0)