fix: encode Swagger URL, add Markdown copy

This commit is contained in:
estrogen elf
2025-05-31 17:24:43 -05:00
parent adc8b0c0f1
commit fb5fbe1fea
2 changed files with 10 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ public partial class PathOperationViewModel : ObservableObject
public OperationViewModel Operation { get; }
public string Url { get; }
public string Markdown { get; }
[ObservableProperty] private bool _isBusy;
[ObservableProperty] private Lazy<RequestViewModel> _request;
@@ -27,7 +28,8 @@ public partial class PathOperationViewModel : ObservableObject
{
Method = pathOperation.Method.ToUpper()
});
Url = $"https://swagger.dysolix.dev/lcu/#/{pathOperation.Tag}/{pathOperation.Operation.OperationId}";
Url = $"https://swagger.dysolix.dev/lcu/#/{Uri.EscapeDataString(pathOperation.Tag)}/{pathOperation.Operation.OperationId}";
Markdown = $"[{pathOperation.Method.ToUpper()} {Path}]({Url})";
}
[RelayCommand]
@@ -59,4 +61,10 @@ public partial class PathOperationViewModel : ObservableObject
{
App.MainWindow?.Clipboard?.SetTextAsync(Url);
}
[RelayCommand]
private void CopyMarkdown()
{
App.MainWindow?.Clipboard?.SetTextAsync(Markdown);
}
}

View File

@@ -58,6 +58,7 @@
<Grid.ContextFlyout>
<MenuFlyout>
<MenuItem Header="Copy Swagger URL" Command="{Binding CopyUrlCommand}"/>
<MenuItem Header="Copy Markdown" Command="{Binding CopyMarkdownCommand}"/>
</MenuFlyout>
</Grid.ContextFlyout>
<TextBlock