Skip to content

Commit

Permalink
Merge pull request #1890 from microsoft/mk/update-workbench-to-parse-…
Browse files Browse the repository at this point in the history
…31-docs

Update workbench tool to parse 3.1 and YAML docs
  • Loading branch information
MaggieKimani1 authored Oct 28, 2024
2 parents ab0ecf9 + 924661c commit 5c35c7b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Microsoft.OpenApi.Workbench/MainModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.OpenApi.Extensions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Services;
using Microsoft.OpenApi.Validations;

Expand Down Expand Up @@ -158,6 +159,7 @@ public OpenApiSpecVersion Version
_version = value;
OnPropertyChanged(nameof(IsV2_0));
OnPropertyChanged(nameof(IsV3_0));
OnPropertyChanged(nameof(IsV3_1));
}
}

Expand Down Expand Up @@ -185,6 +187,12 @@ public bool IsV3_0
set => Version = OpenApiSpecVersion.OpenApi3_0;
}

public bool IsV3_1
{
get => Version == OpenApiSpecVersion.OpenApi3_1;
set => Version = OpenApiSpecVersion.OpenApi3_1;
}

/// <summary>
/// Handling method when the property with given name has changed.
/// </summary>
Expand All @@ -203,6 +211,9 @@ protected void OnPropertyChanged(string propertyName)
/// </summary>
internal async Task ParseDocumentAsync()
{
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader());
OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader());

Stream stream = null;
try
{
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.OpenApi.Workbench/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
</StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Label>Version:</Label>
<RadioButton GroupName="Format" Content="V3.1.0" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV3_1}" />
<RadioButton GroupName="Format" Content="V3.0.1" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV3_0}" />
<RadioButton GroupName="Format" Content="V2.0" Padding="5" Height="24" VerticalAlignment="Top" IsChecked="{Binding IsV2_0}" />
</StackPanel>
Expand Down

0 comments on commit 5c35c7b

Please sign in to comment.