Skip to content

feat: RSS-SE-17 render endpoint list in viewer - #28

Merged
FierceSloth merged 5 commits into
feature/swaggerViewerfrom
story/RSS-SE-17_renderEndpointListInViewer
Jul 9, 2026
Merged

FierceSloth merged 5 commits into
feature/swaggerViewerfrom
story/RSS-SE-17_renderEndpointListInViewer

Conversation

@FierceSloth

@FierceSloth FierceSloth commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

📋 Trello Task ID

  • RSS-SE-17 (Task ID / Trello Card)
  • No ID (Global fix or chore)

⚡️ Summary

  • Implement groupEndpoints logic with unit tests
  • Define strict TypeScript interfaces for OpenAPI schema
  • Create EndpointList UI component to render grouped paths
  • Build SwaggerViewer widget and connect it with parsed schema

🛠 Type of change

  • feat (New feature)
  • fix (Bug fix)
  • refactor (Code improvement / Refactoring without changing logic)
  • style (Formatting, CSS)
  • docs (Documentation)
  • chore (Configs, Build)
  • test (Testing)

📷 Screenshots / GIFs

image

Summary by CodeRabbit

  • New Features

    • Добавлен просмотрщик Swagger/OpenAPI с отображением заголовка, описания, версии и серверов.
    • Эндпоинты теперь показываются списком по группам с аккордеонами и бейджами методов.
    • Расширены доступные цвета бейджей и добавлены новые визуальные стили.
  • Bug Fixes

    • Улучшена верстка страницы и блоков со списками, чтобы интерфейс корректнее занимал доступное пространство.
    • Добавлены стили и анимации для более плавного раскрытия разделов.

@vercel

vercel Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
swagger-editor-app Ready Ready Preview, Comment Jul 9, 2026 3:06pm

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3f7244fc-1ed5-4b06-a011-69c47bced96f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Добавлена функциональность просмотра OpenAPI-схемы: доменные типы и группировка эндпоинтов по тегам, переиспользуемый компонент Accordion, компонент MethodBadge с новыми цветами бейджей, список эндпоинтов EndpointList, виджет SwaggerViewer с Markdown-описанием, интеграция в HomePage и правки стилей макета.

Changes

Swagger Viewer Feature

Layer / File(s) Summary
Типы эндпоинтов и группировка OpenAPI-путей
src/entities/endpoint/types/http-types.ts, src/entities/endpoint/lib/group-endpoints.ts, src/entities/endpoint/lib/group-endpoints.test.ts, src/entities/endpoint/index.ts
Добавлен тип HttpMethod, функция groupEndpoints с типами операций и групп, тесты группировки и переэкспорты сущности.
Компонент Accordion (shared/ui)
src/shared/ui/accordion/accordion.tsx, src/shared/ui/accordion/accordion.module.scss, src/shared/ui/accordion/index.ts
Добавлены обёртки над radix-ui Accordion со стилями и анимациями раскрытия/сворачивания.
Расширение Badge и компонент MethodBadge
src/shared/ui/badge/badge.tsx, src/shared/ui/badge/badge.module.scss, src/app/styles/abstract/_constants.scss, src/entities/endpoint/ui/method-badge/method-badge.tsx, src/entities/endpoint/ui/method-badge/method-badge.module.scss
BadgeColor расширен значениями purple/orange, добавлена переменная --purple-color, реализован MethodBadge с картой соответствий метода цвету/тексту.
Компонент EndpointList
src/entities/endpoint/ui/endpoint-list/endpoint-list.tsx, src/entities/endpoint/ui/endpoint-list/endpoint-list.module.scss
Список групп эндпоинтов рендерится через Accordion с MethodBadge, путём и summary в триггере.
Виджет SwaggerViewer
src/widgets/swagger-viewer/ui/swagger-viewer.tsx, src/widgets/swagger-viewer/ui/swagger-viewer.module.scss, src/widgets/swagger-viewer/index.ts, package.json
Добавлен SwaggerViewer с типом IOpenApiSchema, Markdown-описанием (react-markdown), сервером и EndpointList.
Интеграция SwaggerViewer в HomePage
src/pages/home-page/ui/home-page.tsx
Заглушка просмотра заменена на SwaggerViewer, parsedSchema приведён к IOpenApiSchema, удалён отладочный console.log.
Правки макета и стилей контейнеров
src/app/styles/style.scss, src/widgets/swagger-editor/ui/swagger-editor.module.scss
Обновлены высота/flex-настройки body/main и добавлены flex/overflow ограничители для .editor.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • FierceSloth/swagger-editor-app#16: Обе PR реализуют функциональность Swagger viewer/editor и пересекаются в src/pages/home-page/ui/home-page.tsx при переходе от заглушки к реальному SwaggerViewer.
  • FierceSloth/swagger-editor-app#20: Обе PR изменяют один и тот же пайплайн парсинга и рендера parsedSchema в home-page.tsx.

Suggested reviewers: lexarudak, a-rudak-EIS

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Заголовок кратко и точно отражает ключевое изменение: рендер списка эндпоинтов во viewer.
Description check ✅ Passed Описание заполняет все обязательные разделы шаблона, включая задачу, summary, тип изменения и скриншот.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch story/RSS-SE-17_renderEndpointListInViewer

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (8)
src/entities/endpoint/lib/group-endpoints.ts (1)

37-37: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Список методов дублирует тип HttpMethod — риск рассинхронизации.

Массив httpMethods жёстко продублирован из union-типа HttpMethod (src/entities/endpoint/types/http-types.ts:1). Если в будущем добавится новый метод в тип, но забудут обновить этот массив, операции с новым методом молча выпадут из группировки. Также массив пересоздаётся на каждой итерации внешнего цикла — стоит вынести на уровень модуля.

♻️ Предлагаемый рефакторинг
+const HTTP_METHODS: HttpMethod[] = ['get', 'post', 'put', 'delete', 'patch', 'options', 'head'];
+
 export function groupEndpoints(paths: Record<string, IOpenApiPathItem>): IEndpointGroup[] {
   if (!paths) return [];
   const groupMap: Record<string, IEndpointItem[]> = {};

   for (const [path, methodsObj] of Object.entries(paths)) {
-    const httpMethods: HttpMethod[] = ['get', 'post', 'put', 'delete', 'patch', 'options', 'head'];
-
-    for (const method of httpMethods) {
+    for (const method of HTTP_METHODS) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/entities/endpoint/lib/group-endpoints.ts` at line 37, The httpMethods
list in group-endpoints duplicates the HttpMethod union and is recreated on
every call, so it can drift from the shared type and miss new methods. Refactor
the logic in group-endpoints to source the method set from the HttpMethod
definition used by the endpoint types, and move the reusable list out of the
grouping loop into module scope so it is created once and stays in sync with
HttpMethod.
src/shared/ui/accordion/accordion.tsx (1)

18-24: 📐 Maintainability & Code Quality | 🔵 Trivial

Тип аккордеона захардкожен.

type="multiple" зашит внутри компонента без возможности переопределения (например, type="single" collapsible). Для переиспользуемого shared-компонента стоит вынести это в проп с дефолтным значением.

♻️ Пример рефакторинга
 interface IProps {
   className?: string;
   children?: ReactNode;
+  type?: 'single' | 'multiple';
 }

-export function Accordion({ children, className }: IProps) {
+export function Accordion({ children, className, type = 'multiple' }: IProps) {
   return (
-    <AccordionPrimitive.Root type="multiple" className={clsx(styles.root, className)}>
+    <AccordionPrimitive.Root type={type} className={clsx(styles.root, className)}>
       {children}
     </AccordionPrimitive.Root>
   );
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/shared/ui/accordion/accordion.tsx` around lines 18 - 24, The Accordion
component has its accordion mode hardcoded to multiple, so it cannot be reused
with other Radix types. Update Accordion and its IProps to accept a configurable
type prop (for example single or multiple), keep a sensible default matching
current behavior, and pass that prop through to AccordionPrimitive.Root while
preserving existing children and className handling.
src/entities/endpoint/ui/method-badge/method-badge.tsx (3)

9-12: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

className объявлен обязательным, хотя по сути опционален.

В EndpointList компонент вызывается с className="" (см. связанный сниппет endpoint-list.tsx), что говорит о том, что проп по сути необязателен. Лучше сделать его опциональным со значением по умолчанию.

♻️ Предлагаемое исправление
 interface IProps {
-  className: string;
+  className?: string;
   type: HttpMethod;
 }
-export function MethodBadge({ className, type }: IProps) {
+export function MethodBadge({ className = '', type }: IProps) {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/entities/endpoint/ui/method-badge/method-badge.tsx` around lines 9 - 12,
The MethodBadge props type currently makes className required even though
callers like EndpointList treat it as optional. Update the IProps definition in
method-badge.tsx to make className optional, and adjust the MethodBadge
component to use a default empty string when className is not provided so
existing usage keeps working without forcing callers to pass it.

3-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Непоследовательные пути импорта из модуля badge.

Badge импортируется через barrel @/shared/ui/badge, а тип BadgeColor — напрямую из @/shared/ui/badge/badge, минуя публичный индекс модуля. Стоит либо реэкспортировать BadgeColor из barrel и импортировать оттуда, либо унифицировать оба импорта на прямой путь.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/entities/endpoint/ui/method-badge/method-badge.tsx` around lines 3 - 6,
Imports in method-badge.tsx are inconsistent for the badge module: Badge comes
from the public barrel while BadgeColor is pulled from a direct internal path.
Unify the import strategy by either re-exporting BadgeColor from the badge
barrel and importing both symbols from '`@/shared/ui/badge`', or switching both
imports to the same direct module path; use the existing Badge and BadgeColor
symbols in MethodBadge to locate and update the imports.

14-25: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fallback в methodMaps[type] недостижим при текущей типизации.

methodMaps типизирован как Record<HttpMethod, ...>, что делает объект исчерпывающим по всем значениям HttpMethod. Поэтому || { color: 'gray', text: 'UNKNOWN' } на строке 25 никогда не сработает при корректных типах — это защитный код на случай runtime-значений, не покрытых типом (например, если схема OpenAPI придёт с нестандартным методом). Оставить можно как defensive-код, но стоит явно это прокомментировать.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/entities/endpoint/ui/method-badge/method-badge.tsx` around lines 14 - 25,
The fallback in MethodBadge is unreachable under the current HttpMethod typing
because methodMaps is a complete Record<HttpMethod, ...>, so the UNKNOWN branch
should be treated as intentional defensive handling for unexpected runtime
values. Update the MethodBadge component to make that intent explicit, either by
adding a brief comment near the methodMaps[type] lookup or by adjusting the
typing/lookup so the fallback clearly represents non-typed OpenAPI methods,
while keeping the existing behavior in MethodBadge and methodMaps.
src/entities/endpoint/ui/method-badge/method-badge.module.scss (1)

1-7: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Фиксированная ширина 60px может обрезать длинные названия методов.

При font-size: 11px, padding: 2px 8px и width: 60px для текста вроде OPTIONS (7 символов) или DELETE (6 символов) в моноширинном жирном шрифте доступного места (60px - 16px padding = 44px) может не хватить, что приведёт к переносу строки или визуальному переполнению бейджа. Рекомендуется заменить width на min-width и добавить text-align: center; white-space: nowrap;.

♻️ Предлагаемое исправление
 .badge {
   font-size: 11px;
   font-family: var(--font-mono);
   font-weight: 700;
-  width: 60px;
+  min-width: 60px;
+  text-align: center;
+  white-space: nowrap;
   padding: 2px 8px;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/entities/endpoint/ui/method-badge/method-badge.module.scss` around lines
1 - 7, The method badge in method-badge.module.scss uses a fixed width that can
clip longer HTTP method labels. Update the .badge styles to use min-width
instead of width, and add text-align: center plus white-space: nowrap so methods
like OPTIONS or DELETE stay on one line and remain visually centered. Use the
.badge class as the target for this sizing adjustment.
package.json (1)

49-49: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Несогласованная стратегия версионирования зависимостей.

react и react-dom закреплены точной версией (19.2.4), тогда как react-markdown использует диапазон ^10.1.0, допускающий любые минорные/патч-обновления в рамках major 10. Стоит унифицировать подход — либо зафиксировать точную версию, либо использовать диапазоны везде.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 49, The dependency versioning strategy is inconsistent:
react and react-dom are pinned to exact versions while react-markdown uses a
caret range. Update the package.json dependency entry for react-markdown to
match the same versioning approach used by the other React packages, keeping the
dependency policy consistent across the manifest.
src/widgets/swagger-viewer/ui/swagger-viewer.module.scss (1)

64-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Захардкоженный цвет вместо CSS-переменной.

rgb(96 165 250 / 0.7) в hover-состоянии ссылки не согласован с остальным файлом, где используются CSS-переменные (--blue-color, --text-secondary и т.д.). Стоит завести переменную для hover-оттенка ссылки, чтобы тема оставалась централизованной.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/widgets/swagger-viewer/ui/swagger-viewer.module.scss` around lines 64 -
73, The hover color for links is hardcoded in the swagger viewer styles, which
breaks the file’s variable-based theming. Update the link styles in
swagger-viewer.module.scss so the a:hover color uses a CSS custom property
instead of the literal rgb value, and add or reuse a dedicated hover variable
alongside the existing blue/text variables to keep the theme centralized.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/home-page/ui/home-page.tsx`:
- Around line 19-20: The `parseToObject` result is being unsafely cast to
`IOpenApiSchema` in `home-page.tsx`, while `isSchemaValid` only checks
parsing/linting and not required OpenAPI fields. Add a runtime guard after
`parseToObject` in the `useMemo` flow to verify the object has the OpenAPI shape
needed by `SwaggerViewer` (at least `info` and `paths`) before returning it, and
return a safe fallback such as null/undefined when the shape is incomplete. Use
the existing `parseToObject`, `isSchemaValid`, and `SwaggerViewer` data flow to
place the check where the schema is produced.

In `@src/shared/ui/badge/badge.module.scss`:
- Around line 38-54: The .color-blue selector is duplicated three times in
badge.module.scss, and only the last declaration actually applies. In the badge
color styles, keep a single .color-blue block and remove the redundant
duplicates, using the intended --badge-color value consistently so the badge
palette is unambiguous. Use the repeated .color-blue rule group in
badge.module.scss as the place to consolidate the styling.

---

Nitpick comments:
In `@package.json`:
- Line 49: The dependency versioning strategy is inconsistent: react and
react-dom are pinned to exact versions while react-markdown uses a caret range.
Update the package.json dependency entry for react-markdown to match the same
versioning approach used by the other React packages, keeping the dependency
policy consistent across the manifest.

In `@src/entities/endpoint/lib/group-endpoints.ts`:
- Line 37: The httpMethods list in group-endpoints duplicates the HttpMethod
union and is recreated on every call, so it can drift from the shared type and
miss new methods. Refactor the logic in group-endpoints to source the method set
from the HttpMethod definition used by the endpoint types, and move the reusable
list out of the grouping loop into module scope so it is created once and stays
in sync with HttpMethod.

In `@src/entities/endpoint/ui/method-badge/method-badge.module.scss`:
- Around line 1-7: The method badge in method-badge.module.scss uses a fixed
width that can clip longer HTTP method labels. Update the .badge styles to use
min-width instead of width, and add text-align: center plus white-space: nowrap
so methods like OPTIONS or DELETE stay on one line and remain visually centered.
Use the .badge class as the target for this sizing adjustment.

In `@src/entities/endpoint/ui/method-badge/method-badge.tsx`:
- Around line 9-12: The MethodBadge props type currently makes className
required even though callers like EndpointList treat it as optional. Update the
IProps definition in method-badge.tsx to make className optional, and adjust the
MethodBadge component to use a default empty string when className is not
provided so existing usage keeps working without forcing callers to pass it.
- Around line 3-6: Imports in method-badge.tsx are inconsistent for the badge
module: Badge comes from the public barrel while BadgeColor is pulled from a
direct internal path. Unify the import strategy by either re-exporting
BadgeColor from the badge barrel and importing both symbols from
'`@/shared/ui/badge`', or switching both imports to the same direct module path;
use the existing Badge and BadgeColor symbols in MethodBadge to locate and
update the imports.
- Around line 14-25: The fallback in MethodBadge is unreachable under the
current HttpMethod typing because methodMaps is a complete Record<HttpMethod,
...>, so the UNKNOWN branch should be treated as intentional defensive handling
for unexpected runtime values. Update the MethodBadge component to make that
intent explicit, either by adding a brief comment near the methodMaps[type]
lookup or by adjusting the typing/lookup so the fallback clearly represents
non-typed OpenAPI methods, while keeping the existing behavior in MethodBadge
and methodMaps.

In `@src/shared/ui/accordion/accordion.tsx`:
- Around line 18-24: The Accordion component has its accordion mode hardcoded to
multiple, so it cannot be reused with other Radix types. Update Accordion and
its IProps to accept a configurable type prop (for example single or multiple),
keep a sensible default matching current behavior, and pass that prop through to
AccordionPrimitive.Root while preserving existing children and className
handling.

In `@src/widgets/swagger-viewer/ui/swagger-viewer.module.scss`:
- Around line 64-73: The hover color for links is hardcoded in the swagger
viewer styles, which breaks the file’s variable-based theming. Update the link
styles in swagger-viewer.module.scss so the a:hover color uses a CSS custom
property instead of the literal rgb value, and add or reuse a dedicated hover
variable alongside the existing blue/text variables to keep the theme
centralized.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a520c669-5325-4172-9118-302fda5869ca

📥 Commits

Reviewing files that changed from the base of the PR and between 0f7b8b7 and 7fb92ab.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (22)
  • package.json
  • src/app/styles/abstract/_constants.scss
  • src/app/styles/style.scss
  • src/entities/.gitkeep
  • src/entities/endpoint/index.ts
  • src/entities/endpoint/lib/group-endpoints.test.ts
  • src/entities/endpoint/lib/group-endpoints.ts
  • src/entities/endpoint/types/http-types.ts
  • src/entities/endpoint/ui/endpoint-list/endpoint-list.module.scss
  • src/entities/endpoint/ui/endpoint-list/endpoint-list.tsx
  • src/entities/endpoint/ui/method-badge/method-badge.module.scss
  • src/entities/endpoint/ui/method-badge/method-badge.tsx
  • src/pages/home-page/ui/home-page.tsx
  • src/shared/ui/accordion/accordion.module.scss
  • src/shared/ui/accordion/accordion.tsx
  • src/shared/ui/accordion/index.ts
  • src/shared/ui/badge/badge.module.scss
  • src/shared/ui/badge/badge.tsx
  • src/widgets/swagger-editor/ui/swagger-editor.module.scss
  • src/widgets/swagger-viewer/index.ts
  • src/widgets/swagger-viewer/ui/swagger-viewer.module.scss
  • src/widgets/swagger-viewer/ui/swagger-viewer.tsx

Comment on lines +19 to 20
return parseToObject(rawText) as IOpenApiSchema;
}, [rawText, isSchemaValid]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== home-page.tsx ==\n'
sed -n '1,220p' src/pages/home-page/ui/home-page.tsx | cat -n

printf '\n== swagger-viewer.tsx ==\n'
sed -n '1,240p' src/widgets/swagger-viewer/ui/swagger-viewer.tsx | cat -n

printf '\n== swagger-editor.tsx ==\n'
sed -n '1,260p' src/widgets/swagger-editor/ui/swagger-editor.tsx | cat -n

Repository: FierceSloth/swagger-editor-app

Length of output: 6575


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find the relevant files and show compact AST outlines first.
ast-grep outline src/pages/home-page/ui/home-page.tsx --view expanded || true
ast-grep outline src/widgets/swagger-viewer/ui/swagger-viewer.tsx --view expanded || true
ast-grep outline src/widgets/swagger-editor/ui/swagger-editor.tsx --view expanded || true

Repository: FierceSloth/swagger-editor-app

Length of output: 876


Небезопасное приведение parseToObject к IOpenApiSchema (src/pages/home-page/ui/home-page.tsx:16-20).
isSchemaValid здесь проверяет только ошибки линтера и непустой ввод, но не наличие обязательных полей OpenAPI. SwaggerViewer затем без защит читает schema.info.title и schema.paths, поэтому валидный YAML/JSON без info/paths может упасть в рантайме. Нужен runtime-guard перед as IOpenApiSchema.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home-page/ui/home-page.tsx` around lines 19 - 20, The
`parseToObject` result is being unsafely cast to `IOpenApiSchema` in
`home-page.tsx`, while `isSchemaValid` only checks parsing/linting and not
required OpenAPI fields. Add a runtime guard after `parseToObject` in the
`useMemo` flow to verify the object has the OpenAPI shape needed by
`SwaggerViewer` (at least `info` and `paths`) before returning it, and return a
safe fallback such as null/undefined when the shape is incomplete. Use the
existing `parseToObject`, `isSchemaValid`, and `SwaggerViewer` data flow to
place the check where the schema is produced.

Comment on lines +38 to +54
.color-blue {
--badge-color: rgb(59 130 246 / 0.1);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}

.color-blue {
--badge-color: rgb(59 130 246 / 0.2);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}

.color-blue {
--badge-color: rgb(59 130 246 / 0.2);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Дублирующиеся блоки .color-blue.

Селектор .color-blue объявлен трижды подряд (строки 38-42, 44-48, 50-54). Первый блок использует --badge-color: rgb(59 130 246 / 0.1), а два последующих — идентичный rgb(59 130 246 / 0.2). Из-за каскада CSS реально применяется только последнее значение, а первый блок и повторяющийся третий — мёртвый код, создающий путаницу в намерениях.

♻️ Предлагаемое исправление
-.color-blue {
-  --badge-color: rgb(59 130 246 / 0.1);
-  --badge-text-color: var(--blue-color);
-  --badge-border-color: rgb(59 130 246 / 0.2);
-}
-
 .color-blue {
   --badge-color: rgb(59 130 246 / 0.2);
   --badge-text-color: var(--blue-color);
   --badge-border-color: rgb(59 130 246 / 0.2);
 }
-
-.color-blue {
-  --badge-color: rgb(59 130 246 / 0.2);
-  --badge-text-color: var(--blue-color);
-  --badge-border-color: rgb(59 130 246 / 0.2);
-}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.color-blue {
--badge-color: rgb(59 130 246 / 0.1);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}
.color-blue {
--badge-color: rgb(59 130 246 / 0.2);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}
.color-blue {
--badge-color: rgb(59 130 246 / 0.2);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}
.color-blue {
--badge-color: rgb(59 130 246 / 0.2);
--badge-text-color: var(--blue-color);
--badge-border-color: rgb(59 130 246 / 0.2);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/shared/ui/badge/badge.module.scss` around lines 38 - 54, The .color-blue
selector is duplicated three times in badge.module.scss, and only the last
declaration actually applies. In the badge color styles, keep a single
.color-blue block and remove the redundant duplicates, using the intended
--badge-color value consistently so the badge palette is unambiguous. Use the
repeated .color-blue rule group in badge.module.scss as the place to consolidate
the styling.

Comment on lines +32 to +63
export function groupEndpoints(paths: Record<string, IOpenApiPathItem>): IEndpointGroup[] {
if (!paths) return [];
const groupMap: Record<string, IEndpointItem[]> = {};

for (const [path, methodsObj] of Object.entries(paths)) {
const httpMethods: HttpMethod[] = ['get', 'post', 'put', 'delete', 'patch', 'options', 'head'];

for (const method of httpMethods) {
const details = methodsObj[method];
if (!details) continue;

const tag = details.tags?.[0] || path.split('/').filter(Boolean)[0] || 'default';

if (!groupMap[tag]) {
groupMap[tag] = [];
}

groupMap[tag].push({
id: `${method}-${path}`,
method,
path,
summary: details.summary || '',
details,
});
}
}

return Object.entries(groupMap).map(([tag, endpoints]) => ({
tag,
endpoints,
}));
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work)

Comment on lines +12 to +40
export function EndpointList({ className, groups }: IProps) {
return (
<div className={clsx(styles.listWrapper, className)}>
{groups.map((group) => (
<div key={group.tag} className={styles.group}>
<h2 className={styles.tagTitle}>{group.tag}</h2>

<Accordion>
{group.endpoints.map((endpoint) => (
<AccordionItem key={endpoint.id} value={endpoint.id}>
<AccordionTrigger>
<div className={styles.triggerWrapper}>
<MethodBadge type={endpoint.method} className="" />
<span className={styles.pathText}>{endpoint.path}</span>
<span className={styles.summaryText}>{endpoint.summary}</span>
</div>
</AccordionTrigger>

<AccordionContent>
<div className={styles.placeholderContent}>Endpoint Content</div>
</AccordionContent>
</AccordionItem>
))}
</Accordion>
</div>
))}
</div>
);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work)

This branch was successfully deployed

1 active deployment
Preview — 57c5c59f Deployed Jul 9, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants