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
6 changes: 2 additions & 4 deletions src/Microsoft.OpenApi.Readers/Interface/IDiagnostic.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

namespace Microsoft.OpenApi.Readers.Interface
{
Expand Down
6 changes: 2 additions & 4 deletions src/Microsoft.OpenApi.Readers/Interface/IOpenApiReader.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using Microsoft.OpenApi.Models;

Expand Down
88 changes: 44 additions & 44 deletions src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net46; netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors></Authors>
<Company>Microsoft</Company>
<Product>Microsoft.OpenApi.Readers</Product>
<PackageId>Microsoft.OpenApi.Readers</PackageId>
<Version>1.0.0-beta008</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<AssemblyName>Microsoft.OpenApi.Readers</AssemblyName>
<RootNamespace>Microsoft.OpenApi.Readers</RootNamespace>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworks>net46; netstandard2.0</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors></Authors>
<Company>Microsoft</Company>
<Product>Microsoft.OpenApi.Readers</Product>
<PackageId>Microsoft.OpenApi.Readers</PackageId>
<Version>1.0.0-beta008</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<AssemblyName>Microsoft.OpenApi.Readers</AssemblyName>
<RootNamespace>Microsoft.OpenApi.Readers</RootNamespace>
<SignAssembly>true</SignAssembly>
</PropertyGroup>

<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.OpenApi.xml</DocumentationFile>
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\Microsoft.OpenApi.xml</DocumentationFile>
<AssemblyOriginatorKeyFile>..\Microsoft.OpenApi.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<Compile Remove="ReferenceServices\OpenApiReferenceServiceBase.cs" />
</ItemGroup>
<ItemGroup>
<Compile Remove="ReferenceServices\OpenApiReferenceServiceBase.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="SharpYaml" Version="1.6.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SharpYaml" Version="1.6.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Update="Properties\SRResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>SRResource.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Update="Properties\SRResource.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>SRResource.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\SRResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>SRResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\SRResource.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>SRResource.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>
6 changes: 2 additions & 4 deletions src/Microsoft.OpenApi.Readers/OpenApiDiagnostic.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System.Collections.Generic;
using Microsoft.OpenApi.Readers.Interface;
Expand Down
30 changes: 14 additions & 16 deletions src/Microsoft.OpenApi.Readers/OpenApiError.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using Microsoft.OpenApi.Exceptions;

Expand All @@ -12,16 +10,6 @@ namespace Microsoft.OpenApi.Readers
/// </summary>
public class OpenApiError
{
/// <summary>
/// Message explaining the error.
/// </summary>
public string Message { get; set; }

/// <summary>
/// Pointer to the location of the error.
/// </summary>
public string Pointer { get; set; }

/// <summary>
/// Initializes the <see cref="OpenApiError"/> class using the message and pointer from the given exception.
/// </summary>
Expand All @@ -36,10 +24,20 @@ public OpenApiError(OpenApiException exception)
/// </summary>
public OpenApiError(string pointer, string message)
{
this.Pointer = pointer;
this.Message = message;
Pointer = pointer;
Message = message;
}

/// <summary>
/// Message explaining the error.
/// </summary>
public string Message { get; set; }

/// <summary>
/// Pointer to the location of the error.
/// </summary>
public string Pointer { get; set; }

/// <summary>
/// Gets the string representation of <see cref="OpenApiError"/>.
/// </summary>
Expand Down
6 changes: 2 additions & 4 deletions src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System.IO;
using System.Linq;
Expand Down
8 changes: 3 additions & 5 deletions src/Microsoft.OpenApi.Readers/OpenApiStringReader.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System.IO;
using Microsoft.OpenApi.Readers.Interface;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers.Interface;

namespace Microsoft.OpenApi.Readers
{
Expand Down
6 changes: 2 additions & 4 deletions src/Microsoft.OpenApi.Readers/ParseNodes/FixedFieldMap.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
using System.Collections.Generic;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
using SharpYaml.Serialization;
Expand Down
23 changes: 11 additions & 12 deletions src/Microsoft.OpenApi.Readers/ParseNodes/ListNode.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using SharpYaml.Serialization;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Exceptions;
using SharpYaml.Serialization;

namespace Microsoft.OpenApi.Readers.ParseNodes
{
internal class ListNode : ParseNode, IEnumerable<ParseNode>
{
private readonly YamlSequenceNode nodeList;
private readonly YamlSequenceNode _nodeList;

public ListNode(ParsingContext context, OpenApiDiagnostic diagnostic, YamlSequenceNode sequenceNode) : base(
context,
diagnostic)
{
nodeList = sequenceNode;
_nodeList = sequenceNode;
}

public override List<T> CreateList<T>(Func<MapNode, T> map)
{
var yamlSequence = nodeList;
var yamlSequence = _nodeList;
if (yamlSequence == null)
{
throw new OpenApiException(
$"Expected list at line {nodeList.Start.Line} while parsing {typeof(T).Name}");
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
}

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

public override List<T> CreateSimpleList<T>(Func<ValueNode, T> map)
{
var yamlSequence = nodeList;
var yamlSequence = _nodeList;
if (yamlSequence == null)
{
throw new OpenApiException(
$"Expected list at line {nodeList.Start.Line} while parsing {typeof(T).Name}");
$"Expected list at line {_nodeList.Start.Line} while parsing {typeof(T).Name}");
}

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

public IEnumerator<ParseNode> GetEnumerator()
{
return nodeList.Select(n => Create(Context, Diagnostic, n)).ToList().GetEnumerator();
return _nodeList.Select(n => Create(Context, Diagnostic, n)).ToList().GetEnumerator();
}

IEnumerator IEnumerable.GetEnumerator()
Expand All @@ -71,6 +69,7 @@ public override IOpenApiAny CreateAny()
{
array.Add(node.CreateAny());
}

return array;
}
}
Expand Down
Loading