diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..91e7ce5 --- /dev/null +++ b/.github/workflows/nuget.yml @@ -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 --include-symbols -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 }} \ No newline at end of file diff --git a/BlazorOpenApi.sln b/BlazorOpenApi.sln index 25210e5..827bba5 100644 --- a/BlazorOpenApi.sln +++ b/BlazorOpenApi.sln @@ -7,6 +7,12 @@ 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 + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/BlazorOpenApi/BlazorOpenApi.csproj b/BlazorOpenApi/BlazorOpenApi.csproj index f960120..435f2fb 100644 --- a/BlazorOpenApi/BlazorOpenApi.csproj +++ b/BlazorOpenApi/BlazorOpenApi.csproj @@ -1,5 +1,14 @@  - + + true + Alexander Shabarshov + + OpenAPI documentation generator for Blazor applications. + + https://github.com/unclshura/BlazorOpenApi + openapi, c#, blazor, api, ui, rest, web + + diff --git a/BlazorOpenApi/Properties/launchSettings.json b/BlazorOpenApi/Properties/launchSettings.json deleted file mode 100644 index 0887d65..0000000 --- a/BlazorOpenApi/Properties/launchSettings.json +++ /dev/null @@ -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" - } - } - } -} diff --git a/Demo/BlazorOpenApi.Demo.csproj b/Demo/BlazorOpenApi.Demo.csproj index 3eaaf49..e71e639 100644 --- a/Demo/BlazorOpenApi.Demo.csproj +++ b/Demo/BlazorOpenApi.Demo.csproj @@ -1,5 +1,9 @@  + + false + + diff --git a/LICENSE.txt b/LICENSE.txt index 8aa2645..08d67a3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -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 diff --git a/README.md b/README.md index 0989e33..a42a7da 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,74 @@ # Blazor OpenAPI UI -`!!! DEV VERSION DO NOT USE !!!` +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. -## LICENSE +## Screenshots + +[Light mode](docs/light.png) +[Dark mode](docs/dark.png) +[Examples generation](docs/example-data.png)] + +## 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 + +``` + +To customize the palette you can use something like this: +```razor + + +@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) \ No newline at end of file diff --git a/docs/dark.png b/docs/dark.png new file mode 100644 index 0000000..4a6b852 Binary files /dev/null and b/docs/dark.png differ diff --git a/docs/example-data.png b/docs/example-data.png new file mode 100644 index 0000000..17dc50b Binary files /dev/null and b/docs/example-data.png differ diff --git a/docs/light.png b/docs/light.png new file mode 100644 index 0000000..61f1c69 Binary files /dev/null and b/docs/light.png differ