Refactor OpenAPI usage in Razor components

Removed `@using Microsoft.OpenApi.Models` and related namespaces from various Razor component files to streamline OpenAPI model usage. Updated null checks to include opening braces for improved readability. Modified `_Imports.razor` to include new namespaces `BlazorOpenApi` and `BlazorOpenApi.Controls`, while removing outdated OpenAPI imports.
This commit is contained in:
Alexander Shabarshov 2025-03-26 09:48:47 +00:00
parent a01262ff8a
commit a154bd9b8c
18 changed files with 19 additions and 61 deletions

View File

@ -1,6 +1,4 @@
@using Microsoft.OpenApi.Any @if (Value != null)
@if (Value != null)
{ {
<div class="e-item"> <div class="e-item">
@switch (Value.AnyType) @switch (Value.AnyType)

View File

@ -1,4 +1,3 @@
@using Microsoft.OpenApi.Models
@if ( Value != null ) @if ( Value != null )
{ {
@if (Value.Schemas?.Count > 0) @if (Value.Schemas?.Count > 0)

View File

@ -1,6 +1,4 @@
@using Microsoft.OpenApi.Models @if (Value != null)
@if (Value != null)
{ {
<div class="descriminator"> <div class="descriminator">
<Text Value="@Value.PropertyName" /> <Text Value="@Value.PropertyName" />

View File

@ -1,7 +1,4 @@
@using Microsoft.OpenApi.Any @if (Value != null || Example != null )
@using Microsoft.OpenApi.Models
@if (Value != null || Example != null )
{ {
<div class="e-title"> <div class="e-title">
@if (!string.IsNullOrWhiteSpace(Name)) @if (!string.IsNullOrWhiteSpace(Name))

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (Value != null)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (Value != null)
{ {
<div class="header"> <div class="header">
<h1 class="h-title">@Value.Title <span class="h-version">@Value.Version</span></h1> <h1 class="h-title">@Value.Title <span class="h-version">@Value.Version</span></h1>

View File

@ -1,5 +1,3 @@
@using Microsoft.OpenApi.Models
@if (Value != null) @if (Value != null)
{ {
<div class="mt-body"> <div class="mt-body">

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (Value != null)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (Value != null)
{ {
<div class="op-header @OperationClass" @onclick="Expand"> <div class="op-header @OperationClass" @onclick="Expand">
<div class="op-type">@Operation</div> <div class="op-type">@Operation</div>

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (Value != null)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (Value != null)
{ {
<tr> <tr>
<td> <td>

View File

@ -1,6 +1,4 @@
@using Microsoft.OpenApi.Models @if ( Value != null )
@if ( Value != null )
{ {
<div class="p-style @StyleClass">@Value</div> <div class="p-style @StyleClass">@Value</div>
} }

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (Value?.Count > 0)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (Value?.Count > 0)
{ {
<table class="op-params parameter"> <table class="op-params parameter">
@foreach (var p in Value) @foreach (var p in Value)

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (!string.IsNullOrWhiteSpace(Key) || Value != null)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (!string.IsNullOrWhiteSpace(Key) || Value != null)
{ {
@if (!string.IsNullOrWhiteSpace(@Value?.Summary) || !string.IsNullOrWhiteSpace(Value?.Description)) @if (!string.IsNullOrWhiteSpace(@Value?.Summary) || !string.IsNullOrWhiteSpace(Value?.Description))
{ {

View File

@ -1,5 +1,3 @@
@using Microsoft.OpenApi.Models
@if (Value != null) @if (Value != null)
{ {
<div class="request"> <div class="request">

View File

@ -1,5 +1,3 @@
@using Microsoft.OpenApi.Models
@if (ResolvedValue != null) @if (ResolvedValue != null)
{ {
<div class="response"> <div class="response">

View File

@ -1,5 +1,3 @@
@using Microsoft.OpenApi.Models
@if (Value?.Count > 0) @if (Value?.Count > 0)
{ {
<div class="responses"> <div class="responses">

View File

@ -1,6 +1,4 @@
@using Microsoft.OpenApi.Models @if ( Value != null )
@if ( Value != null )
{ {
<tr> <tr>
<td> <td>

View File

@ -1,6 +1,4 @@
@using Microsoft.OpenApi.Models @if ( ResolvedValue != null )
@if ( ResolvedValue != null )
{ {
<table class="schema"> <table class="schema">
<SchemaChildControl Value="@ResolvedValue" Title="@Title" Required="@Required" Collapsed="@Collapsed"/> <SchemaChildControl Value="@ResolvedValue" Title="@Title" Required="@Required" Collapsed="@Collapsed"/>

View File

@ -1,8 +1,4 @@
@using System.Text.Json @if (Value != null && Value.Count > 0)
@using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@if (Value != null && Value.Count > 0)
{ {
<h2>Servers</h2> <h2>Servers</h2>
<table class="servers"> <table class="servers">

View File

@ -1,4 +1,5 @@
@using System.Net.Http @using BlazorOpenApi
@using BlazorOpenApi.Controls
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization @using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Forms @using Microsoft.AspNetCore.Components.Forms
@ -6,5 +7,8 @@
@using Microsoft.AspNetCore.Components.Web @using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components.Web.Virtualization @using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop @using Microsoft.JSInterop
@using BlazorOpenApi @using Microsoft.OpenApi.Any
@using BlazorOpenApi.Controls @using Microsoft.OpenApi.Models
@using Microsoft.OpenApi.Readers
@using System.Net.Http
@using System.Text.Json