Skip to content

Commit 5c35c7b

Browse files
Merge pull request #1890 from microsoft/mk/update-workbench-to-parse-31-docs
Update workbench tool to parse 3.1 and YAML docs
2 parents ab0ecf9 + 924661c commit 5c35c7b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Microsoft.OpenApi.Workbench/MainModel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using Microsoft.OpenApi.Extensions;
1212
using Microsoft.OpenApi.Models;
1313
using Microsoft.OpenApi.Reader;
14+
using Microsoft.OpenApi.Readers;
1415
using Microsoft.OpenApi.Services;
1516
using Microsoft.OpenApi.Validations;
1617

@@ -158,6 +159,7 @@ public OpenApiSpecVersion Version
158159
_version = value;
159160
OnPropertyChanged(nameof(IsV2_0));
160161
OnPropertyChanged(nameof(IsV3_0));
162+
OnPropertyChanged(nameof(IsV3_1));
161163
}
162164
}
163165

@@ -185,6 +187,12 @@ public bool IsV3_0
185187
set => Version = OpenApiSpecVersion.OpenApi3_0;
186188
}
187189

190+
public bool IsV3_1
191+
{
192+
get => Version == OpenApiSpecVersion.OpenApi3_1;
193+
set => Version = OpenApiSpecVersion.OpenApi3_1;
194+
}
195+
188196
/// <summary>
189197
/// Handling method when the property with given name has changed.
190198
/// </summary>
@@ -203,6 +211,9 @@ protected void OnPropertyChanged(string propertyName)
203211
/// </summary>
204212
internal async Task ParseDocumentAsync()
205213
{
214+
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
215+
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());
216+
206217
Stream stream = null;
207218
try
208219
{

src/Microsoft.OpenApi.Workbench/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
</StackPanel>
4141
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
4242
<Label>Version:</Label>
43+
<RadioButton GroupName="Format" Content="V3.1.0" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV3_1}" />
4344
<RadioButton GroupName="Format" Content="V3.0.1" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV3_0}" />
4445
<RadioButton GroupName="Format" Content="V2.0" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV2_0}" />
4546
</StackPanel>

0 commit comments

Comments
 (0)