Skip to content

Submissions image quality#1585

Merged
ragnep merged 3 commits intomainfrom
submissions-image-quality
Oct 30, 2025
Merged

Submissions image quality#1585
ragnep merged 3 commits intomainfrom
submissions-image-quality

Conversation

@ragnep
Copy link
Copy Markdown
Contributor

@ragnep ragnep commented Oct 30, 2025

Summary by CodeRabbit

  • New Features
    • Introduced new TDH endpoints for managing grants and editions with pagination and filtering capabilities
    • Enhanced image scaling with additional resolution options for media display
    • Added image preview modal functionality for improved media viewing experience

Signed-off-by: ragnep <ragneinfo@gmail.com>
Signed-off-by: ragnep <ragneinfo@gmail.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 30, 2025

Walkthrough

Extended image scaling support across the component hierarchy by introducing imageScale prop threading from container components to leaf media renderers. Added new AUTOx800 and AUTOx1080 scale options to ImageScale enum. Integrated modal image preview functionality into DropListItemContentMediaImage. Expanded OpenAPI spec with new TDH-related endpoints and schemas for editions and grants management.

Changes

Cohort / File(s) Summary
Test mock updates
__tests__/components/DropListItemContentMediaImage.test.tsx
Updated ImageScale mock to include AUTOx1080 enum value alongside existing AUTOx450
Image scale enum extension
helpers/image.helpers.ts
Added two new enum members: AUTOx800 and AUTOx1080 to ImageScale enum
Media component scaling
components/drops/view/item/content/media/DropListItemContentMedia.tsx, components/drops/view/item/content/media/DropListItemContentMediaImage.tsx
Introduced imageScale?: ImageScale prop with AUTOx450 default; threaded prop into image URI selection for primary source; added modal image ref and fullscreen targeting logic
Wave drop component chain prop threading
components/waves/drop/MemesSingleWaveDropInfoPanel.tsx, components/waves/drop/SingleWaveDropContent.tsx, components/waves/drops/WaveDropContent.tsx, components/waves/drops/WaveDropPart.tsx, components/waves/drops/WaveDropPartDrop.tsx, components/waves/drops/WaveDropPartContent.tsx, components/waves/drops/WaveDropPartContentMedias.tsx
Propagated mediaImageScale/imageScale prop through component hierarchy with ImageScale.AUTOx1080 sourced from top-level and ImageScale.AUTOx450 as fallback default
OpenAPI specification
openapi.yaml
Added TDH endpoints (GET /tdh-editions/*, GET/POST /tdh-grants), new schemas (ApiTdhEdition, ApiTdhEditionsPage, ApiTdhGrant, ApiTdhGrantsPage, ApiTdhGrantStatus, ApiTdhGrantTargetChain, ApiPageSortDirection, ApiCreateTdhGrant), and text formatting adjustments

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Component chain prop threading (7 files): Highly repetitive, mechanical changes following a consistent pattern; each file adds prop to interface/destructuring and forwards to child—low cognitive load per file.
  • Modal image implementation in DropListItemContentMediaImage.tsx: New ref management and fullscreen targeting logic warrants closer inspection.
  • OpenAPI schema additions: Substantial additions of multiple new endpoints and schemas with pagination/filtering support; requires validation of endpoint consistency and schema completeness relative to backend contract.
  • Cascading defaults: Verify AUTOx450 vs AUTOx1080 defaults are applied correctly at each layer and reach intended leaf components.

Suggested reviewers

  • simo6529

Poem

🐰 ✨ Through waves and drops the scales now flow,
From 1080 down to 450—watch them grow!
Modal images peek with fullscreen might,
New TDH grants spring forth to light! 🎬

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The PR title "Submissions image quality" is partially related to the changeset but is misleading and incomplete. The image-related changes are primarily about adding configurable image scaling (AUTOx800, AUTOx1080) and threading an imageScale prop through multiple components, not about improving image quality. The term "quality" is a misnomer for what is actually a scaling/sizing feature. Additionally, the PR contains a substantial set of changes to openapi.yaml that introduce TDH endpoints and schemas, which are entirely unrelated to submissions or images and represent a significant portion of the changeset. A developer scanning the history would not understand the full scope or intent of these changes based on this title alone. The title should be more specific and accurate. Consider revising to something like "Add configurable image scaling and TDH endpoints" or breaking this into two separate PRs if the image scaling and TDH features are independent. If these changes must be in a single PR, the title should reflect both major components and use accurate terminology (e.g., "image scaling" rather than "image quality").
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch submissions-image-quality

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@sonarqubecloud
Copy link
Copy Markdown

@ragnep ragnep merged commit 2a84065 into main Oct 30, 2025
7 of 8 checks passed
@ragnep ragnep deleted the submissions-image-quality branch October 30, 2025 12:44
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2242d6 and 86e32d1.

⛔ Files ignored due to path filters (9)
  • generated/models/ApiCreateTdhGrant.ts is excluded by !**/generated/**
  • generated/models/ApiPageSortDirection.ts is excluded by !**/generated/**
  • generated/models/ApiTdhEdition.ts is excluded by !**/generated/**
  • generated/models/ApiTdhEditionsPage.ts is excluded by !**/generated/**
  • generated/models/ApiTdhGrant.ts is excluded by !**/generated/**
  • generated/models/ApiTdhGrantStatus.ts is excluded by !**/generated/**
  • generated/models/ApiTdhGrantTargetChain.ts is excluded by !**/generated/**
  • generated/models/ApiTdhGrantsPage.ts is excluded by !**/generated/**
  • generated/models/ObjectSerializer.ts is excluded by !**/generated/**
📒 Files selected for processing (12)
  • __tests__/components/DropListItemContentMediaImage.test.tsx (1 hunks)
  • components/drops/view/item/content/media/DropListItemContentMedia.tsx (3 hunks)
  • components/drops/view/item/content/media/DropListItemContentMediaImage.tsx (5 hunks)
  • components/waves/drop/MemesSingleWaveDropInfoPanel.tsx (2 hunks)
  • components/waves/drop/SingleWaveDropContent.tsx (2 hunks)
  • components/waves/drops/WaveDropContent.tsx (4 hunks)
  • components/waves/drops/WaveDropPart.tsx (4 hunks)
  • components/waves/drops/WaveDropPartContent.tsx (4 hunks)
  • components/waves/drops/WaveDropPartContentMedias.tsx (2 hunks)
  • components/waves/drops/WaveDropPartDrop.tsx (4 hunks)
  • helpers/image.helpers.ts (1 hunks)
  • openapi.yaml (7 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx}: Do not include any comments in the code
Use react-query for data fetching
Always add readonly before props

Use TypeScript across the codebase

Files:

  • components/waves/drops/WaveDropPartContent.tsx
  • components/waves/drops/WaveDropPartContentMedias.tsx
  • components/waves/drop/MemesSingleWaveDropInfoPanel.tsx
  • components/waves/drops/WaveDropPart.tsx
  • components/drops/view/item/content/media/DropListItemContentMedia.tsx
  • helpers/image.helpers.ts
  • components/drops/view/item/content/media/DropListItemContentMediaImage.tsx
  • components/waves/drops/WaveDropPartDrop.tsx
  • components/waves/drops/WaveDropContent.tsx
  • components/waves/drop/SingleWaveDropContent.tsx
  • __tests__/components/DropListItemContentMediaImage.test.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursorrules)

**/*.tsx: Use FontAwesome for icons
Use TailwindCSS for styling

Use React functional components with hooks for UI components

Files:

  • components/waves/drops/WaveDropPartContent.tsx
  • components/waves/drops/WaveDropPartContentMedias.tsx
  • components/waves/drop/MemesSingleWaveDropInfoPanel.tsx
  • components/waves/drops/WaveDropPart.tsx
  • components/drops/view/item/content/media/DropListItemContentMedia.tsx
  • components/drops/view/item/content/media/DropListItemContentMediaImage.tsx
  • components/waves/drops/WaveDropPartDrop.tsx
  • components/waves/drops/WaveDropContent.tsx
  • components/waves/drop/SingleWaveDropContent.tsx
  • __tests__/components/DropListItemContentMediaImage.test.tsx
__tests__/**

📄 CodeRabbit inference engine (tests/AGENTS.md)

Place Jest test suites under the __tests__ directory mirroring source folders (e.g., components, contexts, hooks, utils)

Files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
__tests__/components/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (tests/AGENTS.md)

Use @testing-library/react and @testing-library/user-event for React component tests

Files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
**/__tests__/**

📄 CodeRabbit inference engine (AGENTS.md)

Place tests in __tests__ directories when organizing test suites

Files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
**/*.test.tsx

📄 CodeRabbit inference engine (AGENTS.md)

When colocating tests with components, name them ComponentName.test.tsx

Files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Mock external dependencies and APIs in tests

Files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
🧠 Learnings (12)
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Keep mocks up to date with the real implementations they represent

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Keep mock implementations minimal—only what’s necessary for the test scenarios

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Document non-obvious expected behaviour directly in the mock file

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-10-23T06:36:34.125Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: AGENTS.md:0-0
Timestamp: 2025-10-23T06:36:34.125Z
Learning: Applies to **/*.test.{ts,tsx} : Mock external dependencies and APIs in tests

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Mock only external dependencies or heavy functionality; avoid over-mocking internal logic

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:30.950Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:30.950Z
Learning: Applies to __tests__/components/**/*.{ts,tsx,js,jsx} : Use `testing-library/react` and `testing-library/user-event` for React component tests

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Review mocks periodically and remove unused mock modules

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Name mock files to mirror the real module names so jest.mock('module') can pick them up automatically

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Organise mocks to mirror the real module structure so import paths remain consistent

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Use Jest’s built-in mocking for module replacement; keep manual mocks simple and lightweight

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/*.{test,spec}.{js,jsx,ts,tsx} : In tests, use jest.mock('module') with a bare module specifier to load the corresponding manual mock

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
📚 Learning: 2025-09-28T12:33:07.561Z
Learnt from: CR
PR: 6529-Collections/6529seize-frontend#0
File: __mocks__/AGENTS.md:0-0
Timestamp: 2025-09-28T12:33:07.561Z
Learning: Applies to __mocks__/**/__mocks__/**/*.{js,jsx,ts,tsx} : Place manual mock modules under a __mocks__ directory so Jest can auto-resolve them

Applied to files:

  • __tests__/components/DropListItemContentMediaImage.test.tsx
🧬 Code graph analysis (2)
components/waves/drops/WaveDropPartContentMedias.tsx (1)
generated/models/ApiDropPart.ts (1)
  • ApiDropPart (17-60)
components/drops/view/item/content/media/DropListItemContentMediaImage.tsx (1)
helpers/image.helpers.ts (1)
  • getScaledImageUri (16-44)
🔇 Additional comments (17)
openapi.yaml (5)

5782-5786: Good addition: ApiPageSortDirection enum for consistency.

The new ApiPageSortDirection enum (ASC/DESC) properly standardizes sort direction handling across paginated endpoints. This aligns well with existing paging conventions used in other endpoints like /aggregated-activity and /waves/{id}/leaderboard.


2230-2303: TDH Edition endpoints well-structured with consistent parameter patterns.

The three new TDH Edition endpoints (/tdh-editions/wallet/{wallet}, /tdh-editions/consolidation/{consolidation_key}, /tdh-editions/identity/{identity}) follow established API patterns:

  • Consistent filtering by contract, token_id, edition_id
  • Proper pagination with page, page_size defaults (50 max)
  • Sorting support with reasonable defaults
  • Appropriate error responses (400 for wallet validation, 404 for not found)

6308-6338: ApiCreateTdhGrant schema properly defined with required fields.

The ApiCreateTdhGrant schema correctly specifies required creation fields (target_chain, target_contract, target_tokens, valid_to, tdh_rate, is_irrevocable) and includes helpful descriptions for token ranges and irrevocable flag semantics. Consistent with other creation request schemas in the spec.


6158-6205: TDH Edition schemas align with existing patterns for paged responses.

ApiTdhEdition and ApiTdhEditionsPage follow the established pattern used by ApiNftOwner/ApiNftOwnerPage and other paged entities. Proper inclusion of optional fields (wallet, consolidation_key, profile) and required core fields (contract, id, edition_id, balance, hodl_rate, days_held).


6205-6276: TDH Grant schemas properly structured with status enum and page wrapper.

ApiTdhGrant includes appropriate required fields and properly references ApiTdhGrantStatus enum (PENDING/FAILED/GRANTED) and ApiTdhGrantTargetChain enum (ETHEREUM_MAINNET). ApiTdhGrantsPage correctly wraps results using ApiPageBase for pagination metadata consistency.

components/waves/drop/MemesSingleWaveDropInfoPanel.tsx (1)

24-24: LGTM! Image scale integration looks good.

The import and prop passing are clean. Using AUTOx1080 for the info panel makes sense for displaying higher-quality images in the detail view.

Also applies to: 90-90

components/waves/drop/SingleWaveDropContent.tsx (1)

7-7: LGTM! Consistent image scale usage.

The changes correctly integrate the image scale prop and consistently use AUTOx1080 for single wave drop content.

Also applies to: 26-26

components/waves/drops/WaveDropPart.tsx (1)

7-7: LGTM! Proper prop threading with sensible defaults.

The changes correctly add and forward the mediaImageScale prop with a sensible default of AUTOx450, maintaining backward compatibility.

Also applies to: 22-22, 42-42, 135-135

helpers/image.helpers.ts (1)

5-6: LGTM! Clean enum extension.

The new AUTOx800 and AUTOx1080 values follow the existing naming pattern and integrate seamlessly with the existing getScaledImageUri function.

components/waves/drops/WaveDropPartContent.tsx (1)

11-11: LGTM! Consistent prop threading.

The changes properly add the mediaImageScale prop with a default value and forward it correctly to WaveDropPartContentMedias.

Also applies to: 30-30, 50-50, 136-140

components/drops/view/item/content/media/DropListItemContentMedia.tsx (1)

4-4: LGTM! Proper image scale integration.

The changes correctly add the imageScale prop with a sensible default and forward it only to the image media component, which is appropriate since scaling is image-specific.

Also applies to: 28-29, 35-35, 66-66

components/waves/drops/WaveDropPartDrop.tsx (1)

6-6: LGTM! Proper prop addition and forwarding.

The changes correctly add the mediaImageScale prop with a default value and forward it to WaveDropPartContent, following the established pattern in this file.

Also applies to: 22-22, 39-39, 63-63

components/waves/drops/WaveDropPartContentMedias.tsx (1)

5-5: LGTM! Clean prop threading for image scaling.

The imageScale prop is properly integrated with appropriate typing, readonly modifier, and sensible default value. The prop is correctly passed down to DropListItemContentMedia only in the interactive path.

Also applies to: 11-11, 18-18, 44-44

components/waves/drops/WaveDropContent.tsx (1)

5-5: LGTM! Consistent prop forwarding pattern.

The mediaImageScale prop follows the same clean pattern as related components, with proper TypeScript typing, readonly modifier, and consistent default value.

Also applies to: 21-21, 38-38, 54-54

components/drops/view/item/content/media/DropListItemContentMediaImage.tsx (3)

35-35: LGTM! ImageScale prop properly integrated.

The imageScale prop is correctly typed with readonly modifier and given a sensible default value matching the other components in this PR.

Also applies to: 41-41


50-50: LGTM! Modal image fullscreen integration is correct.

The addition of modalImageRef and its integration with the fullscreen handler is well-implemented. The fallback chain modalImageRef.current ?? imgRef.current ensures fullscreen works correctly whether the modal is open or not. The change to an empty dependency array [] is appropriate since refs are stable objects.

Also applies to: 97-102, 149-149


278-278: LGTM! Key functional improvement implemented.

Replacing the hardcoded ImageScale.AUTOx450 with the configurable imageScale prop enables the scaling flexibility that is the core objective of this PR.

Comment on lines 5 to 8
jest.mock('@/helpers/image.helpers', () => ({
getScaledImageUri: (_src: string) => _src,
ImageScale: { AUTOx450: 'AUTOx450' },
ImageScale: { AUTOx450: 'AUTOx450', AUTOx1080: 'AUTOx1080' },
}));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Update mock to include all ImageScale enum values.

The mock is missing AUTOx800 from the ImageScale enum. For completeness and to prevent future test issues, include all enum values from the real implementation.

Apply this diff:

 jest.mock('@/helpers/image.helpers', () => ({
   getScaledImageUri: (_src: string) => _src,
-  ImageScale: { AUTOx450: 'AUTOx450', AUTOx1080: 'AUTOx1080' },
+  ImageScale: { 
+    W_AUTO_H_50: 'AUTOx50',
+    W_200_H_200: '200x200',
+    AUTOx450: 'AUTOx450',
+    AUTOx800: 'AUTOx800',
+    AUTOx1080: 'AUTOx1080'
+  },
 }));

Based on learnings

📝 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
jest.mock('@/helpers/image.helpers', () => ({
getScaledImageUri: (_src: string) => _src,
ImageScale: { AUTOx450: 'AUTOx450' },
ImageScale: { AUTOx450: 'AUTOx450', AUTOx1080: 'AUTOx1080' },
}));
jest.mock('@/helpers/image.helpers', () => ({
getScaledImageUri: (_src: string) => _src,
ImageScale: {
W_AUTO_H_50: 'AUTOx50',
W_200_H_200: '200x200',
AUTOx450: 'AUTOx450',
AUTOx800: 'AUTOx800',
AUTOx1080: 'AUTOx1080'
},
}));
🤖 Prompt for AI Agents
In __tests__/components/DropListItemContentMediaImage.test.tsx around lines 5 to
8, the jest mock for '@/helpers/image.helpers' omits the ImageScale.AUTOx800
enum value; update the mock to include AUTOx800 alongside AUTOx450 and AUTOx1080
so the mocked ImageScale matches the real implementation and prevents
missing-enum test failures.

Comment thread openapi.yaml
Comment on lines +2451 to +2519
get:
tags:
- TdhGrants
summary: Get TDH grants
operationId: getTdhGrants
parameters:
- name: grantor
in: query
required: false
schema:
type: string
- name: target_contract
in: query
required: false
schema:
type: string
- name: target_chain
in: query
required: false
schema:
type: string
- name: status
in: query
required: false
schema:
$ref: "#/components/schemas/ApiTdhGrantStatus"
- name: sort_direction
in: query
required: false
schema:
$ref: "#/components/schemas/ApiPageSortDirection"
- name: sort
in: query
required: false
schema:
type: string
enum:
- created_at
- valid_from
- valid_to
- tdh_rate
default: created_at
- name: page
in: query
required: false
schema:
type: integer
format: int64
minimum: 1
default: 1
- name: page_size
in: query
required: false
schema:
type: integer
format: int64
minimum: 1
maximum: 2000
default: 100
responses:
"201":
description: successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/ApiTdhGrantsPage"
"400":
description: Invalid request
post:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Incorrect HTTP response code for GET endpoint at line 2511.

The GET operation at /tdh-grants (line 2451) returns a 201 (Created) response code at line 2511, which violates HTTP semantics. GET requests should return 200 (OK) for successful operations, not 201 (Created). The 201 status code is reserved for POST/PUT operations that create resources.

Apply this diff to fix the response code:

  /tdh-grants:
    get:
      tags:
        - TdhGrants
      summary: Get TDH grants
      operationId: getTdhGrants
      parameters:
        - name: grantor
          in: query
          required: false
          schema:
            type: string
        - name: target_contract
          in: query
          required: false
          schema:
            type: string
        - name: target_chain
          in: query
          required: false
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/ApiTdhGrantStatus"
        - name: sort_direction
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/ApiPageSortDirection"
        - name: sort
          in: query
          required: false
          schema:
            type: string
            enum:
              - created_at
              - valid_from
              - valid_to
              - tdh_rate
            default: created_at
        - name: page
          in: query
          required: false
          schema:
            type: integer
            format: int64
            minimum: 1
            default: 1
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            format: int64
            minimum: 1
            maximum: 2000
            default: 100
      responses:
-       "201":
+       "200":
          description: successful operation
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiTdhGrantsPage"
          "400":
          description: Invalid request

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In openapi.yaml around lines 2451 to 2519, the GET /tdh-grants operation
incorrectly documents a "201" response for success; change the success response
code to "200" and ensure the response schema remains ApiTdhGrantsPage so the GET
returns 200 OK with the same application/json schema.

@coderabbitai coderabbitai Bot mentioned this pull request Oct 31, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Dec 11, 2025
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