mirror of
https://github.com/unclshura/BlazorOpenApi.git
synced 2025-12-21 09:51:53 +00:00
Compare commits
7 Commits
31d8a3c655
...
c61bf2f374
| Author | SHA1 | Date | |
|---|---|---|---|
| c61bf2f374 | |||
| f4f9a5c88d | |||
| 2843b981b4 | |||
| d60e9f9a98 | |||
| e9c02bd491 | |||
| 69e69291f9 | |||
| e04304b71f |
40
.github/workflows/nuget.yml
vendored
Normal file
40
.github/workflows/nuget.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
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,6 +7,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorOpenApi.Demo", "Demo\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorOpenApi", "BlazorOpenApi\BlazorOpenApi.csproj", "{57AD9505-4132-4D79-BF67-03E9F5FC0483}"
|
||||
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
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
||||
@ -1,4 +1,14 @@
|
||||
<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>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
@ -7,4 +17,9 @@
|
||||
<PackageReference Include="System.Text.Json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="../README.md" Pack="true" PackagePath="\"/>
|
||||
<None Include="../docs/**" Pack="true" PackagePath="\docs\"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -54,7 +54,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
exampleData[parameter.Name] = GenerateExampleFromSchema(parameter.Schema);
|
||||
var ex = GenerateExampleFromSchema(parameter.Schema);
|
||||
if (ex != null)
|
||||
exampleData[parameter.Name] = ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,26 +0,0 @@
|
||||
{
|
||||
"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,3 +1,70 @@
|
||||
# Blazor OpenAPI UI
|
||||
|
||||
Blazor implementation of SwaggerUI-like interface.
|
||||
Author: *unclshura*
|
||||
|
||||
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 List<string> _order = new();
|
||||
|
||||
public event EventHandler Changed;
|
||||
public event EventHandler? Changed;
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MudBlazor" />
|
||||
<PackageReference Include="System.Text.Json" />
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) [year] [fullname]
|
||||
Copyright (c) 2025 Alexander Shabarshov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
74
README.md
74
README.md
@ -1,6 +1,76 @@
|
||||
# Blazor OpenAPI UI
|
||||
|
||||
`!!! DEV VERSION DO NOT USE !!!`
|
||||
Author: *unclshura*
|
||||
|
||||
## LICENSE
|
||||
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.
|
||||
|
||||
## 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)
|
||||
BIN
docs/dark.png
Normal file
BIN
docs/dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 204 KiB |
BIN
docs/example-data.png
Normal file
BIN
docs/example-data.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
BIN
docs/light.png
Normal file
BIN
docs/light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 KiB |
Loading…
x
Reference in New Issue
Block a user