-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #511 from microsoft/hotfix/1.2.3
Hotfix/1.2.3
- Loading branch information
Showing
11 changed files
with
94 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT license. | ||
|
||
using System.IO; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using Microsoft.OpenApi.Any; | ||
using Microsoft.OpenApi.Models; | ||
using Microsoft.OpenApi.Readers.ParseNodes; | ||
using Microsoft.OpenApi.Readers.V3; | ||
using Xunit; | ||
|
||
namespace Microsoft.OpenApi.Readers.Tests.V3Tests | ||
{ | ||
[Collection("DefaultSettings")] | ||
public class OpenApiResponseTests | ||
{ | ||
private const string SampleFolderPath = "V3Tests/Samples/OpenApiResponse/"; | ||
|
||
[Fact] | ||
public void ResponseWithReferencedHeaderShouldReferenceComponent() | ||
{ | ||
using (var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "responseWithHeaderReference.yaml"))) | ||
{ | ||
var openApiDoc = new OpenApiStreamReader().Read(stream, out var diagnostic); | ||
|
||
var response = openApiDoc.Components.Responses["Test"]; | ||
|
||
Assert.Same(response.Headers.First().Value, openApiDoc.Components.Headers.First().Value); | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ft.OpenApi.Readers.Tests/V3Tests/Samples/OpenApiResponse/responseWithHeaderReference.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Example of response referencing a header | ||
version: 1.0.0 | ||
components: | ||
headers: | ||
X-Test: | ||
description: Test | ||
schema: | ||
type: string | ||
responses: | ||
Test: | ||
description: Test Repsonse | ||
headers: | ||
X-Test: | ||
$ref: '#/components/headers/X-Test' |