mirror of
https://github.com/unclshura/BlazorOpenApi.git
synced 2025-12-21 09:51:53 +00:00
Compare commits
No commits in common. "c61bf2f374aafcecec50bb97d0f623ea7ef012b5" and "31d8a3c655564cd07465b616ef363f68fbd95f02" have entirely different histories.
c61bf2f374
...
31d8a3c655
40
.github/workflows/nuget.yml
vendored
40
.github/workflows/nuget.yml
vendored
@ -1,40 +0,0 @@
|
|||||||
name: "Deploy to NuGet"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
env:
|
|
||||||
PROJECT_PATH: 'BlazorOpenApi/BlazorOpenApi.csproj'
|
|
||||||
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
|
|
||||||
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
name: 'Deploy'
|
|
||||||
runs-on: 'ubuntu-latest'
|
|
||||||
steps:
|
|
||||||
- name: 'Checkout'
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: 'Install dotnet'
|
|
||||||
uses: actions/setup-dotnet@v1
|
|
||||||
with:
|
|
||||||
dotnet-version: '9.0.x'
|
|
||||||
|
|
||||||
- name: 'Restore packages'
|
|
||||||
run: dotnet restore ${{ env.PROJECT_PATH }}
|
|
||||||
|
|
||||||
- name: 'Build project'
|
|
||||||
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
|
|
||||||
|
|
||||||
- name: 'Get Version'
|
|
||||||
id: version
|
|
||||||
uses: battila7/get-version-action@v2
|
|
||||||
|
|
||||||
- name: 'Pack project'
|
|
||||||
run: dotnet pack ${{ env.PROJECT_PATH }} --no-restore --no-build --configuration Release -p:PackageVersion=${{ steps.version.outputs.version-without-v }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }}
|
|
||||||
|
|
||||||
- name: 'Push package'
|
|
||||||
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg -k ${{ secrets.NUGET_AUTH_TOKEN }} -s ${{ env.NUGET_SOURCE_URL }}
|
|
||||||
@ -7,13 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorOpenApi.Demo", "Demo\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorOpenApi", "BlazorOpenApi\BlazorOpenApi.csproj", "{57AD9505-4132-4D79-BF67-03E9F5FC0483}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorOpenApi", "BlazorOpenApi\BlazorOpenApi.csproj", "{57AD9505-4132-4D79-BF67-03E9F5FC0483}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8EC462FD-D22E-90A8-E5CE-7E832BA40C5D}"
|
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
LICENSE.txt = LICENSE.txt
|
|
||||||
.github\workflows\nuget.yml = .github\workflows\nuget.yml
|
|
||||||
README.md = README.md
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
@ -1,14 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
<PropertyGroup>
|
|
||||||
<IsPackable>true</IsPackable>
|
|
||||||
<Authors>Alexander Shabarshov</Authors>
|
|
||||||
<Description>
|
|
||||||
OpenAPI documentation generator for Blazor applications.
|
|
||||||
</Description>
|
|
||||||
<PackageProjectUrl>https://github.com/unclshura/BlazorOpenApi</PackageProjectUrl>
|
|
||||||
<PackageTags>openapi, c#, blazor, api, ui, rest, web</PackageTags>
|
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||||
@ -17,9 +7,4 @@
|
|||||||
<PackageReference Include="System.Text.Json" />
|
<PackageReference Include="System.Text.Json" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="../README.md" Pack="true" PackagePath="\"/>
|
|
||||||
<None Include="../docs/**" Pack="true" PackagePath="\docs\"/>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@ -54,9 +54,7 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var ex = GenerateExampleFromSchema(parameter.Schema);
|
exampleData[parameter.Name] = GenerateExampleFromSchema(parameter.Schema);
|
||||||
if (ex != null)
|
|
||||||
exampleData[parameter.Name] = ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
BlazorOpenApi/Properties/launchSettings.json
Normal file
26
BlazorOpenApi/Properties/launchSettings.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"iisSettings": {
|
||||||
|
"iisExpress": {
|
||||||
|
"applicationUrl": "http://localhost:57161",
|
||||||
|
"sslPort": 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"profiles": {
|
||||||
|
"http": {
|
||||||
|
"commandName": "Project",
|
||||||
|
"dotnetRunMessages": true,
|
||||||
|
"launchBrowser": true,
|
||||||
|
"applicationUrl": "http://localhost:5026",
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"IIS Express": {
|
||||||
|
"commandName": "IISExpress",
|
||||||
|
"launchBrowser": true,
|
||||||
|
"environmentVariables": {
|
||||||
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,70 +1,3 @@
|
|||||||
# Blazor OpenAPI UI
|
# Blazor OpenAPI UI
|
||||||
|
|
||||||
Author: *unclshura*
|
Blazor implementation of SwaggerUI-like interface.
|
||||||
|
|
||||||
This is a Blazor implementation of a SwaggerUI-like interface. It allows you to view your OpenAPI
|
|
||||||
specifications in a user-friendly way. The motication of this project is to provide a Blazor component that can be used in Blazor applications
|
|
||||||
to display OpenAPI specifications. Unlike SwaggerUI, this project does not require any JavaScript dependencies.
|
|
||||||
It is a pure Blazor implementation.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
You can install the package from NuGet:
|
|
||||||
```bash
|
|
||||||
dotnet add package BlazorOpenApi
|
|
||||||
```
|
|
||||||
|
|
||||||
Source code:
|
|
||||||
```bash
|
|
||||||
Github: https://github.com/unclshura/BlazorOpenApi
|
|
||||||
HTTPS: https://github.com/unclshura/BlazorOpenApi.git
|
|
||||||
SSH: git@github.com:unclshura/BlazorOpenApi.git
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- View OpenAPI specifications in a user-friendly way
|
|
||||||
- Dark and light themes
|
|
||||||
- Fully customizable color palette
|
|
||||||
- Separate CSS styles for every element
|
|
||||||
- Examples generation
|
|
||||||
- Pure Blazor implementation
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
To use the component, add the following line to your `_Imports.razor` file:
|
|
||||||
```razor
|
|
||||||
@using BlazorOpenApi
|
|
||||||
@using BlazorOpenApi.Controls
|
|
||||||
```
|
|
||||||
Then, you can use the component in your Blazor application:
|
|
||||||
```razor
|
|
||||||
<OpenAPIUIControl Url="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml" />
|
|
||||||
```
|
|
||||||
|
|
||||||
To customize the palette you can use something like this:
|
|
||||||
```razor
|
|
||||||
<OpenAPIUIControl Url="@Url" Palette="@TestPalette"/>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter]
|
|
||||||
[SupplyParameterFromQuery(Name = "url")]
|
|
||||||
public string Url { get; set; } = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json";
|
|
||||||
|
|
||||||
private OpenApiUiPalette TestPalette
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var p = new OpenApiUiPalette().Clone();
|
|
||||||
p.Foreground[7] = "blue";
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The demo application is available in the `Demo` folder - https://github.com/unclshura/BlazorOpenApi/tree/master/Demo.
|
|
||||||
|
|
||||||
# LICENSE
|
|
||||||
MIT
|
|
||||||
|
|||||||
@ -9,7 +9,7 @@ internal class TableOfContentsTree : ITableOfContentsTree
|
|||||||
private readonly Dictionary<string, TocTreeNode> _nodes = new();
|
private readonly Dictionary<string, TocTreeNode> _nodes = new();
|
||||||
private readonly List<string> _order = new();
|
private readonly List<string> _order = new();
|
||||||
|
|
||||||
public event EventHandler? Changed;
|
public event EventHandler Changed;
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,9 +1,5 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="MudBlazor" />
|
<PackageReference Include="MudBlazor" />
|
||||||
<PackageReference Include="System.Text.Json" />
|
<PackageReference Include="System.Text.Json" />
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 Alexander Shabarshov
|
Copyright (c) [year] [fullname]
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
74
README.md
74
README.md
@ -1,76 +1,6 @@
|
|||||||
# Blazor OpenAPI UI
|
# Blazor OpenAPI UI
|
||||||
|
|
||||||
Author: *unclshura*
|
`!!! DEV VERSION DO NOT USE !!!`
|
||||||
|
|
||||||
This is a Blazor implementation of a SwaggerUI-like interface. It allows you to view your OpenAPI
|
## LICENSE
|
||||||
specifications in a user-friendly way. The motication of this project is to provide a Blazor component that can be used in Blazor applications
|
|
||||||
to display OpenAPI specifications. Unlike SwaggerUI, this project does not require any JavaScript dependencies.
|
|
||||||
It is a pure Blazor implementation.
|
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
{ width=250px }
|
|
||||||
{ width=250px }
|
|
||||||
]{ width=250px }
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
You can install the package from NuGet:
|
|
||||||
```bash
|
|
||||||
dotnet add package BlazorOpenApi
|
|
||||||
```
|
|
||||||
|
|
||||||
Source code:
|
|
||||||
```bash
|
|
||||||
Github: https://github.com/unclshura/BlazorOpenApi
|
|
||||||
HTTPS: https://github.com/unclshura/BlazorOpenApi.git
|
|
||||||
SSH: git@github.com:unclshura/BlazorOpenApi.git
|
|
||||||
```
|
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
- View OpenAPI specifications in a user-friendly way
|
|
||||||
- Dark and light themes
|
|
||||||
- Fully customizable color palette
|
|
||||||
- Separate CSS styles for every element
|
|
||||||
- Examples generation
|
|
||||||
- Pure Blazor implementation
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
To use the component, add the following line to your `_Imports.razor` file:
|
|
||||||
```razor
|
|
||||||
@using BlazorOpenApi
|
|
||||||
@using BlazorOpenApi.Controls
|
|
||||||
```
|
|
||||||
Then, you can use the component in your Blazor application:
|
|
||||||
```razor
|
|
||||||
<OpenAPIUIControl Url="https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml" />
|
|
||||||
```
|
|
||||||
|
|
||||||
To customize the palette you can use something like this:
|
|
||||||
```razor
|
|
||||||
<OpenAPIUIControl Url="@Url" Palette="@TestPalette"/>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter]
|
|
||||||
[SupplyParameterFromQuery(Name = "url")]
|
|
||||||
public string Url { get; set; } = "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.json";
|
|
||||||
|
|
||||||
private OpenApiUiPalette TestPalette
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var p = new OpenApiUiPalette().Clone();
|
|
||||||
p.Foreground[7] = "blue";
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
The demo application is available in the `Demo` folder - https://github.com/unclshura/BlazorOpenApi/tree/master/Demo.
|
|
||||||
|
|
||||||
# LICENSE
|
|
||||||
[MIT](LICENSE)
|
[MIT](LICENSE)
|
||||||
BIN
docs/dark.png
BIN
docs/dark.png
Binary file not shown.
|
Before Width: | Height: | Size: 204 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 36 KiB |
BIN
docs/light.png
BIN
docs/light.png
Binary file not shown.
|
Before Width: | Height: | Size: 192 KiB |
Loading…
x
Reference in New Issue
Block a user