Skip to content

fix(catalog): target /api/apis and adapt backend rows - #1347

Merged
greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
rupesh-kumar-sah:feat/issue-1327
Oct 19, 2026
Merged

greatest0fallt1me merged 1 commit into
CalloraOrg:mainfrom
rupesh-kumar-sah:feat/issue-1327

Conversation

@rupesh-kumar-sah

Copy link
Copy Markdown
Contributor

Summary

Resolves the contract mismatch between Callora-Frontend and Callora-Backend GET /api/apis.

Key fixes:

  • Path Alignment: Changed CATALOG_PATH to /api/apis constructed via apiUrl('/api/apis').
  • Backend Row Adapter: Implemented adaptBackendApi(row) which:
    • Stringifies numeric id to string.
    • Maps developer.name to provider.name, developer.website to provider.url, and logo_url to provider.avatar.
    • Maps base_url to baseUrl.
    • Derives pricePerRequest from the minimum endpoint price. If pricing is omitted or 0 without endpoints, sets pricingOnRequest: true so cards display "Pricing on request".
    • Tolerates missing nested developer objects and drops only malformed rows (id == null).
  • Conditional Requests & 304 Caching: Catalog fetch requests send If-None-Match using cached ETag and reuse cached data on 304 Not Modified.
  • Fallback Policy: When API_BASE is configured, fetch failures reject rather than silently falling back to sample data, surfacing stale-data or error states in MarketplacePage. When unconfigured, mock sample data is displayed with a "Sample data" indicator.
  • Documentation: Updated docs/Configuration.md with /api/apis backend path notes and contract specifications.

Closes #1327

Verification

  • Added comprehensive Vitest unit tests in src/api/catalogApi.test.ts covering all 8 specified scenarios (15/15 passing, 95.97% line coverage).
  • Added MarketplacePage.test.tsx integration tests (3/3 passing).
  • npx tsc -p tsconfig.json --noEmit passed cleanly with 0 type errors.
  • npm run build succeeded with 0 errors.

- Align CATALOG_PATH with backend route GET /api/apis using apiUrl()
- Implement tolerant adaptBackendApi adapter mapping backend rows to APIItem
- Preserve pricingOnRequest flag when endpoint pricing is absent
- Send If-None-Match header and keep cached catalogue data on 304 response
- Make backend fetch failures reject when API_BASE is configured to display error states
- Display 'Sample data' indicator in demo mode when API_BASE is empty
- Add comprehensive vitest suites for catalogApi adapter and MarketplacePage
- Update Configuration.md with /api/apis backend contract notes

Closes CalloraOrg#1327
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@rupesh-kumar-sah Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@greatest0fallt1me
greatest0fallt1me merged commit 3ce9abb into CalloraOrg:main Oct 19, 2026
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.

Align the marketplace catalogue client with the backend GET /api/apis contract

2 participants