Skip to content

feat: RSS-SE-18 display endpoint parameters in viewer - #29

Merged
FierceSloth merged 10 commits into
feature/swaggerViewerfrom
story/RSS-SE-18_displayEndpointParametersInViewer
Jul 9, 2026
Merged

FierceSloth merged 10 commits into
feature/swaggerViewerfrom
story/RSS-SE-18_displayEndpointParametersInViewer

Conversation

@FierceSloth

@FierceSloth FierceSloth commented Jul 8, 2026 •

Copy link
Copy Markdown
Owner

📋 Trello Task ID

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

⚡️ Summary

  • Extract OpenAPI parameter and endpoint type declarations to openapi-types.ts
  • Create EndpointParameters UI component to display query, header, path, and cookie parameters
  • Implement i18n support in English and Russian for endpoint parameters table
  • Integrate EndpointParameters into the EndpointList accordion view
  • Add parameter merging logic in groupEndpoints to combine path-level and operation-level parameters
  • Apply code review suggestions to home-page schema validation and Badge component exports
  • Add tests for endpoint parameters component

🛠 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

  • Новые функции

    • Добавлен блок отображения параметров эндпоинта в списке эндпоинтов (name, in, type, required, description) с корректным отображением Yes/No и значением — при отсутствии описания.
    • Добавлены строки локализации для раздела параметров в RU/EN.
  • Баг-фиксы

    • Параметры уровня path и операции теперь корректно объединяются: одноимённые параметры переопределяются значениями из уровня операции.
    • Блок параметров не отображается, если параметров нет.

@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 4:27pm

@coderabbitai

coderabbitai Bot commented Jul 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 18171901-77c2-43b0-a2f2-b71556fa8ba9

📥 Commits

Reviewing files that changed from the base of the PR and between 6da9769 and 9c02393.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json
✅ Files skipped from review due to trivial changes (1)
  • package.json

📝 Walkthrough

Walkthrough

Добавлены OpenAPI-типы, объединение параметров path/operation и новый UI для отображения параметров endpoint-а с локализацией и тестами. Также обновлены Badge, SwaggerViewer и связанный рендер на главной странице.

Changes

EndpointParameters

Layer / File(s) Summary
Общие типы OpenAPI
src/entities/endpoint/types/openapi-types.ts, src/entities/endpoint/index.ts
Новый модуль определяет OpenAPI-типы и группы эндпоинтов; index.ts переэкспортирует их и добавляет EndpointParameters.
Слияние параметров пути и операции
src/entities/endpoint/lib/group-endpoints.ts, src/entities/endpoint/lib/group-endpoints.test.ts
Добавлен mergeParameters, объединяющий параметры по ${in}:${name}; groupEndpoints подставляет merged parameters в details, тест проверяет переопределение и сохранение уникальных параметров.
Компонент EndpointParameters
src/entities/endpoint/ui/endpoint-parameters/endpoint-parameters.tsx, src/entities/endpoint/ui/endpoint-parameters/endpoint-parameters.module.scss, messages/en.json, messages/ru.json, src/entities/endpoint/ui/endpoint-list/endpoint-list.tsx, src/entities/endpoint/ui/endpoint-parameters/endpoint-parameters.test.tsx, package.json
Новый компонент рендерит таблицу параметров с Badge, переводами и пустым состоянием; стили и строки локализации добавлены; EndpointList подключает компонент; тесты покрывают рендер и значения таблицы; добавлена зависимость @swc/helpers.
Badge: тип className и экспорт BadgeColor
src/entities/endpoint/ui/method-badge/method-badge.tsx, src/shared/ui/badge/index.ts, src/shared/ui/badge/badge.module.scss
className в MethodBadge стал опциональным, BadgeColor переэкспортируется из badge/index.ts, удалён дублирующийся CSS-блок .color-blue.
Упрощение проверки схемы в SwaggerViewer
src/widgets/swagger-viewer/ui/swagger-viewer.tsx, src/pages/home-page/ui/home-page.tsx
SwaggerViewer больше не принимает isSchemaValid и возвращает null только при отсутствии schema; HomePage передаёт только parsedSchema и добавляет поясняющие комментарии.

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

Suggested reviewers: lexarudak, a-rudak-EIS

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Заголовок кратко и точно отражает основное изменение: показ параметров endpoint в viewer.
Description check ✅ Passed Описание в основном соответствует шаблону: есть Trello ID, summary, тип изменения и скриншот для UI-изменений.
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-18_displayEndpointParametersInViewer

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: 1

🧹 Nitpick comments (1)
src/widgets/swagger-viewer/ui/swagger-viewer.tsx (1)

24-29: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Задокументировать контракт: schema должна быть уже провалидирована.

После удаления внутренней проверки isSchemaValid ответственность за валидность данных полностью лежит на вызывающей стороне. Поскольку IOpenApiSchema — переиспользуемый экспортируемый тип, стоит добавить короткий JSDoc-комментарий к IProps, поясняющий, что schema должна быть предварительно провалидирована перед передачей, чтобы избежать случайного использования компонента с "сырыми" непроверенными данными в будущем.

♻️ Предлагаемое изменение
 interface IProps {
+  /** Ожидается предварительно провалидированная (например, через Spectral) схема. */
   schema: IOpenApiSchema | null;
 }
🤖 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.tsx` around lines 24 - 29, Add a
short JSDoc note to the `IProps` contract in `SwaggerViewer` clarifying that
`schema` must already be validated before being passed in. Since `SwaggerViewer`
now relies on the caller and only guards against null, document that
`IOpenApiSchema` here represents prevalidated data so future callers don’t treat
the component as a validation boundary.
🤖 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/entities/endpoint/lib/group-endpoints.ts`:
- Around line 2-23: The parameter merge in mergeParameters() collapses
$ref-based parameter objects because they can arrive without in/name, causing
all such entries to share the same undefined:undefined key. Update
mergeParameters() in group-endpoints.ts to resolve or otherwise preserve
reference-only parameters before keying them, and build the deduplication key
only from stable parameter identity from IOpenApiParameter so distinct $ref
items do not overwrite each other.

---

Nitpick comments:
In `@src/widgets/swagger-viewer/ui/swagger-viewer.tsx`:
- Around line 24-29: Add a short JSDoc note to the `IProps` contract in
`SwaggerViewer` clarifying that `schema` must already be validated before being
passed in. Since `SwaggerViewer` now relies on the caller and only guards
against null, document that `IOpenApiSchema` here represents prevalidated data
so future callers don’t treat the component as a validation boundary.
🪄 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: e89c003f-21c7-4f8c-a299-48daf2a31e07

📥 Commits

Reviewing files that changed from the base of the PR and between 7fb92ab and 98db5f2.

📒 Files selected for processing (13)
  • messages/en.json
  • messages/ru.json
  • src/entities/endpoint/index.ts
  • src/entities/endpoint/lib/group-endpoints.ts
  • src/entities/endpoint/types/openapi-types.ts
  • src/entities/endpoint/ui/endpoint-list/endpoint-list.tsx
  • src/entities/endpoint/ui/endpoint-parameters/endpoint-parameters.module.scss
  • src/entities/endpoint/ui/endpoint-parameters/endpoint-parameters.tsx
  • src/entities/endpoint/ui/method-badge/method-badge.tsx
  • src/pages/home-page/ui/home-page.tsx
  • src/shared/ui/badge/badge.module.scss
  • src/shared/ui/badge/index.ts
  • src/widgets/swagger-viewer/ui/swagger-viewer.tsx
💤 Files with no reviewable changes (1)
  • src/shared/ui/badge/badge.module.scss

Comment on lines +2 to 23
import type { IEndpointGroup, IEndpointItem, IOpenApiParameter, IOpenApiPathItem } from '../types/openapi-types';

export interface IOpenApiOperation {
tags?: string[];
summary?: string;
description?: string;
operationId?: string;
[key: string]: unknown;
}
function mergeParameters(
pathParams?: IOpenApiParameter[],
operationParams?: IOpenApiParameter[]
): IOpenApiParameter[] | undefined {
if (!pathParams?.length && !operationParams?.length) return undefined;
if (!pathParams?.length) return operationParams;
if (!operationParams?.length) return pathParams;

export type IOpenApiPathItem = {
[K in HttpMethod]?: IOpenApiOperation;
} & {
parameters?: unknown[];
$ref?: string;
[key: string]: unknown;
};

export interface IEndpointItem {
id: string;
method: HttpMethod;
path: string;
summary: string;
details: IOpenApiOperation;
}
const merged = new Map<string, IOpenApiParameter>();

for (const param of pathParams) {
merged.set(`${param.in}:${param.name}`, param);
}

export interface IEndpointGroup {
tag: string;
endpoints: IEndpointItem[];
for (const param of operationParams) {
merged.set(`${param.in}:${param.name}`, param);
}

return Array.from(merged.values());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Проверить, дереференсится ли OpenAPI-схема (например, через swagger-parser) до вызова groupEndpoints
rg -n "groupEndpoints|SwaggerParser|\\\$RefParser|dereference" --type=ts -C3

Repository: FierceSloth/swagger-editor-app

Length of output: 168


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- files ---\n'
git ls-files | rg '(^|/)src/entities/endpoint/lib/group-endpoints\.ts$|(^|/)src/entities/endpoint/lib/|(^|/)src/entities/endpoint/types/openapi-types\.ts$|(^|/)src/entities/endpoint.*openapi'
printf '\n--- outline group-endpoints ---\n'
ast-grep outline src/entities/endpoint/lib/group-endpoints.ts --view expanded || true
printf '\n--- openapi-types outline ---\n'
ast-grep outline src/entities/endpoint/types/openapi-types.ts --view expanded || true
printf '\n--- search refs for IOpenApiParameter/IEndpointGroup ---\n'
rg -n "IOpenApiParameter|IEndpointGroup|groupEndpoints\(" src/entities/endpoint -C 2

Repository: FierceSloth/swagger-editor-app

Length of output: 259


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- relevant files ---'
git ls-files | rg '(^|/)src/entities/endpoint/lib/group-endpoints\.ts$|(^|/)src/entities/endpoint/types/openapi-types\.ts$|(^|/)src/entities/endpoint/lib/|(^|/)src/entities/endpoint/'

echo
echo '--- outline: src/entities/endpoint/lib/group-endpoints.ts ---'
ast-grep outline src/entities/endpoint/lib/group-endpoints.ts --view expanded || true

echo
echo '--- outline: src/entities/endpoint/types/openapi-types.ts ---'
ast-grep outline src/entities/endpoint/types/openapi-types.ts --view expanded || true

echo
echo '--- search for dereference / parser / groupEndpoints usage ---'
rg -n "groupEndpoints\\(|SwaggerParser|\\$RefParser|dereference|bundle|openapi" src/entities/endpoint -C 3

Repository: FierceSloth/swagger-editor-app

Length of output: 2009


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- group-endpoints.ts ---'
cat -n src/entities/endpoint/lib/group-endpoints.ts

echo
echo '--- group-endpoints.test.ts ---'
cat -n src/entities/endpoint/lib/group-endpoints.test.ts

echo
echo '--- search for dereference / parser / groupEndpoints usage ---'
rg -n 'groupEndpoints\(|SwaggerParser|\$RefParser|dereference|bundle|openapi' src -C 3

Repository: FierceSloth/swagger-editor-app

Length of output: 27535


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- swagger-viewer.tsx ---'
cat -n src/widgets/swagger-viewer/ui/swagger-viewer.tsx

echo
echo '--- swagger-editor.tsx ---'
cat -n src/widgets/swagger-editor/ui/swagger-editor.tsx

echo
echo '--- search for schema state / parsing / conversion ---'
rg -n 'SwaggerViewer|schema:|useState<.*schema|convertFormat|detectFormat|validateSchema|paths:' src/widgets src/features src/app src/pages -C 2

Repository: FierceSloth/swagger-editor-app

Length of output: 19874


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- parse-to-object ---'
cat -n src/shared/lib/parse-to-object.ts

echo
echo '--- home-page ---'
cat -n src/pages/home-page/ui/home-page.tsx

Repository: FierceSloth/swagger-editor-app

Length of output: 2039


Параметры через $ref схлопываются
Если в paths попадают parameter reference objects, mergeParameters() строит ключ undefined:undefined и такие элементы перезаписывают друг друга. parseToObject() схему не dereference'ит, так что этот кейс доходит сюда.

🤖 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` around lines 2 - 23, The
parameter merge in mergeParameters() collapses $ref-based parameter objects
because they can arrive without in/name, causing all such entries to share the
same undefined:undefined key. Update mergeParameters() in group-endpoints.ts to
resolve or otherwise preserve reference-only parameters before keying them, and
build the deduplication key only from stable parameter identity from
IOpenApiParameter so distinct $ref items do not overwrite each other.

{param.required ? t('yes') : t('no')}
</Badge>
</td>
<td className={styles.cellDescription}>{param.description || '—'}</td>

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.

Extract '—' into a named constant

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Okay, I'll fix that in the next PR

@FierceSloth
FierceSloth changed the base branch from story/RSS-SE-17_renderEndpointListInViewer to feature/swaggerViewer July 9, 2026 16:00

This branch was successfully deployed

1 active deployment
Preview — 9c02393b 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