Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update workbench tool to parse 3.1 and YAML docs #1890

Merged
merged 2 commits into from
Oct 28, 2024
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
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
Loading