Skip to content

Commit 4ae5fb5

Browse files
authored
Cleanup code / License header / Minor change to Workbench Output/Error logic (#129)
- Cleanup code - naming - access consistency - Add license header - Minor change to workbench output/error logic - Add DefaultSettings collection to all tests
1 parent 3cbc10e commit 4ae5fb5

File tree

228 files changed

+2523
-2898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+2523
-2898
lines changed

src/Microsoft.OpenApi.Readers/Interface/IDiagnostic.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
namespace Microsoft.OpenApi.Readers.Interface
75
{

src/Microsoft.OpenApi.Readers/Interface/IOpenApiReader.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using Microsoft.OpenApi.Models;
75

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net46; netstandard2.0</TargetFrameworks>
4-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
5-
<Authors></Authors>
6-
<Company>Microsoft</Company>
7-
<Product>Microsoft.OpenApi.Readers</Product>
8-
<PackageId>Microsoft.OpenApi.Readers</PackageId>
9-
<Version>1.0.0-beta008</Version>
10-
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
11-
<AssemblyName>Microsoft.OpenApi.Readers</AssemblyName>
12-
<RootNamespace>Microsoft.OpenApi.Readers</RootNamespace>
13-
<SignAssembly>true</SignAssembly>
14-
</PropertyGroup>
2+
<PropertyGroup>
3+
<TargetFrameworks>net46; netstandard2.0</TargetFrameworks>
4+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
5+
<Authors></Authors>
6+
<Company>Microsoft</Company>
7+
<Product>Microsoft.OpenApi.Readers</Product>
8+
<PackageId>Microsoft.OpenApi.Readers</PackageId>
9+
<Version>1.0.0-beta008</Version>
10+
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
11+
<AssemblyName>Microsoft.OpenApi.Readers</AssemblyName>
12+
<RootNamespace>Microsoft.OpenApi.Readers</RootNamespace>
13+
<SignAssembly>true</SignAssembly>
14+
</PropertyGroup>
1515

16-
<PropertyGroup>
17-
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.OpenApi.xml</DocumentationFile>
18-
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
19-
</PropertyGroup>
16+
<PropertyGroup>
17+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.OpenApi.xml</DocumentationFile>
18+
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
19+
</PropertyGroup>
2020

21-
<ItemGroup>
22-
<Compile Remove="ReferenceServices\OpenApiReferenceServiceBase.cs" />
23-
</ItemGroup>
21+
<ItemGroup>
22+
<Compile Remove="ReferenceServices\OpenApiReferenceServiceBase.cs" />
23+
</ItemGroup>
2424

25-
<ItemGroup>
26-
<PackageReference Include="SharpYaml" Version="1.6.1" />
27-
</ItemGroup>
25+
<ItemGroup>
26+
<PackageReference Include="SharpYaml" Version="1.6.1" />
27+
</ItemGroup>
2828

29-
<ItemGroup>
30-
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
31-
</ItemGroup>
29+
<ItemGroup>
30+
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
31+
</ItemGroup>
3232

33-
<ItemGroup>
34-
<Compile Update="Properties\Resource.Designer.cs">
35-
<DesignTime>True</DesignTime>
36-
<AutoGen>True</AutoGen>
37-
<DependentUpon>Resource.resx</DependentUpon>
38-
</Compile>
39-
<Compile Update="Properties\SRResource.Designer.cs">
40-
<DesignTime>True</DesignTime>
41-
<AutoGen>True</AutoGen>
42-
<DependentUpon>SRResource.resx</DependentUpon>
43-
</Compile>
44-
</ItemGroup>
33+
<ItemGroup>
34+
<Compile Update="Properties\Resource.Designer.cs">
35+
<DesignTime>True</DesignTime>
36+
<AutoGen>True</AutoGen>
37+
<DependentUpon>Resource.resx</DependentUpon>
38+
</Compile>
39+
<Compile Update="Properties\SRResource.Designer.cs">
40+
<DesignTime>True</DesignTime>
41+
<AutoGen>True</AutoGen>
42+
<DependentUpon>SRResource.resx</DependentUpon>
43+
</Compile>
44+
</ItemGroup>
4545

46-
<ItemGroup>
47-
<EmbeddedResource Update="Properties\SRResource.resx">
48-
<Generator>ResXFileCodeGenerator</Generator>
49-
<LastGenOutput>SRResource.Designer.cs</LastGenOutput>
50-
</EmbeddedResource>
51-
</ItemGroup>
46+
<ItemGroup>
47+
<EmbeddedResource Update="Properties\SRResource.resx">
48+
<Generator>ResXFileCodeGenerator</Generator>
49+
<LastGenOutput>SRResource.Designer.cs</LastGenOutput>
50+
</EmbeddedResource>
51+
</ItemGroup>
5252
</Project>

src/Microsoft.OpenApi.Readers/OpenApiDiagnostic.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System.Collections.Generic;
75
using Microsoft.OpenApi.Readers.Interface;

src/Microsoft.OpenApi.Readers/OpenApiError.cs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using Microsoft.OpenApi.Exceptions;
75

@@ -12,16 +10,6 @@ namespace Microsoft.OpenApi.Readers
1210
/// </summary>
1311
public class OpenApiError
1412
{
15-
/// <summary>
16-
/// Message explaining the error.
17-
/// </summary>
18-
public string Message { get; set; }
19-
20-
/// <summary>
21-
/// Pointer to the location of the error.
22-
/// </summary>
23-
public string Pointer { get; set; }
24-
2513
/// <summary>
2614
/// Initializes the <see cref="OpenApiError"/> class using the message and pointer from the given exception.
2715
/// </summary>
@@ -36,10 +24,20 @@ public OpenApiError(OpenApiException exception)
3624
/// </summary>
3725
public OpenApiError(string pointer, string message)
3826
{
39-
this.Pointer = pointer;
40-
this.Message = message;
27+
Pointer = pointer;
28+
Message = message;
4129
}
4230

31+
/// <summary>
32+
/// Message explaining the error.
33+
/// </summary>
34+
public string Message { get; set; }
35+
36+
/// <summary>
37+
/// Pointer to the location of the error.
38+
/// </summary>
39+
public string Pointer { get; set; }
40+
4341
/// <summary>
4442
/// Gets the string representation of <see cref="OpenApiError"/>.
4543
/// </summary>

src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System.IO;
75
using System.Linq;

src/Microsoft.OpenApi.Readers/OpenApiStringReader.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System.IO;
7-
using Microsoft.OpenApi.Readers.Interface;
85
using Microsoft.OpenApi.Models;
6+
using Microsoft.OpenApi.Readers.Interface;
97

108
namespace Microsoft.OpenApi.Readers
119
{

src/Microsoft.OpenApi.Readers/ParseNodes/FixedFieldMap.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System;
75
using System.Collections.Generic;

src/Microsoft.OpenApi.Readers/ParseNodes/JsonPointerExtensions.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System;
75
using SharpYaml.Serialization;

src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,34 @@
1-
// ------------------------------------------------------------
2-
// Copyright (c) Microsoft Corporation. All rights reserved.
3-
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
4-
// ------------------------------------------------------------
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT license.
53

64
using System;
75
using System.Collections;
86
using System.Collections.Generic;
97
using System.Linq;
10-
using SharpYaml.Serialization;
118
using Microsoft.OpenApi.Any;
129
using Microsoft.OpenApi.Exceptions;
10+
using SharpYaml.Serialization;
1311

1412
namespace Microsoft.OpenApi.Readers.ParseNodes
1513
{
1614
internal class ListNode : ParseNode, IEnumerable<ParseNode>
1715
{
18-
private readonly YamlSequenceNode nodeList;
16+
private readonly YamlSequenceNode _nodeList;
1917

2018
public ListNode(ParsingContext context, OpenApiDiagnostic diagnostic, YamlSequenceNode sequenceNode) : base(
2119
context,
2220
diagnostic)
2321
{
24-
nodeList = sequenceNode;
22+
_nodeList = sequenceNode;
2523
}
2624

2725
public override List<T> CreateList<T>(Func<MapNode, T> map)
2826
{
29-
var yamlSequence = nodeList;
27+
var yamlSequence = _nodeList;
3028
if (yamlSequence == null)
3129
{
3230
throw new OpenApiException(
33-
$"Expected list at line {nodeList.Start.Line} while parsing {typeof(T).Name}");
31+
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
3432
}
3533

3634
return yamlSequence.Select(n => map(new MapNode(Context, Diagnostic, n as YamlMappingNode)))
@@ -40,19 +38,19 @@ public override List<T> CreateList<T>(Func<MapNode, T> map)
4038

4139
public override List<T> CreateSimpleList<T>(Func<ValueNode, T> map)
4240
{
43-
var yamlSequence = nodeList;
41+
var yamlSequence = _nodeList;
4442
if (yamlSequence == null)
4543
{
4644
throw new OpenApiException(
47-
$"Expected list at line {nodeList.Start.Line} while parsing {typeof(T).Name}");
45+
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
4846
}
4947

5048
return yamlSequence.Select(n => map(new ValueNode(Context, Diagnostic, (YamlScalarNode)n))).ToList();
5149
}
5250

5351
public IEnumerator<ParseNode> GetEnumerator()
5452
{
55-
return nodeList.Select(n => Create(Context, Diagnostic, n)).ToList().GetEnumerator();
53+
return _nodeList.Select(n => Create(Context, Diagnostic, n)).ToList().GetEnumerator();
5654
}
5755

5856
IEnumerator IEnumerable.GetEnumerator()
@@ -71,6 +69,7 @@ public override IOpenApiAny CreateAny()
7169
{
7270
array.Add(node.CreateAny());
7371
}
72+
7473
return array;
7574
}
7675
}

0 commit comments

Comments
 (0)