Skip to content

Seamless support for NocoDB API v2 and v3#4

Merged
karlspace merged 7 commits intomainfrom
feature-20251009
Oct 10, 2025
Merged

Seamless support for NocoDB API v2 and v3#4
karlspace merged 7 commits intomainfrom
feature-20251009

Conversation

@karlspace
Copy link
Contributor

Unreleased

Features

  • API Version Support: Add seamless support for NocoDB API v2 and v3
    • Implement api_version parameter for client initialization (default: "v2")
    • Add automatic parameter conversion between v2 and v3 formats
      • Pagination: offset/limit (v2) ↔ page/pageSize (v3)
      • Sort: string format (v2) ↔ JSON array format (v3)
      • Operators: automatic conversion (e.g., neneq)
    • Implement BaseIdResolver with caching for v3 API base_id resolution
    • Add v2/v3 support to all Data API methods (14 methods)
    • Add v2/v3 support to all Meta API methods (29 methods)
    • Update NocoDBTable wrapper to support base_id parameter
    • Full backward compatibility maintained for existing v2 code

Documentation

Tests

  • Add 88 new unit tests for v2/v3 functionality
    • 52 tests for PathBuilder and QueryParamAdapter
    • 15 tests for BaseIdResolver
    • 21 integration tests for version switching
  • Update existing tests for new base_id parameter
  • All 454 tests passing with full coverage

…is between NocoDB v2 and v3

- Implement `analyze_api_diff.py` to compare endpoints, parameters, request/response schemas, and generate a markdown report summarizing the differences.
- Implement `analyze_schemas.py` to analyze request/response schemas and query parameters, generating a detailed report on schema changes and observations.
- Updated methods in NocoDBMetaClient to dynamically construct API endpoints based on the API version.
- Added support for base_id in various methods to accommodate API v3 requirements.
- Modified test cases to ensure compatibility with the new API versioning and endpoint structure.
- Adjusted mock setups in tests to reflect changes in API version handling.
…ding automatic parameter conversion and backward compatibility
Copilot AI review requested due to automatic review settings October 10, 2025 13:04
@github-actions
Copy link

🔍 PR Validation Report

Overall Status: ❌ FAILED

Validation Results

Check Status Details
Conventional Commits ⏭️ SKIP failure
Security Scan ⏭️ SKIP Score: 95/100
License Compliance ⏭️ SKIP compliant

⚠️ Action needed: Please address the failing checks before this PR can be merged.


Automated validation by Automation Templates

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements seamless support for NocoDB API v2 and v3 with automatic parameter conversion and backward compatibility. The implementation provides a transparent upgrade path from v2 to v3 without breaking existing code.

Key Changes:

  • Added API version support with automatic parameter conversion (pagination, sorting, operators)
  • Implemented BaseIdResolver with caching for v3 API base_id resolution
  • Extended all Data API and Meta API methods to support both v2 and v3
  • Added comprehensive documentation and examples for API version migration

Reviewed Changes

Copilot reviewed 28 out of 30 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/nocodb_simple_client/api_version.py Core API version support with PathBuilder and QueryParamAdapter
src/nocodb_simple_client/base_resolver.py BaseIdResolver for v3 API base_id resolution and caching
src/nocodb_simple_client/client.py Extended NocoDBClient with v2/v3 support and parameter conversion
src/nocodb_simple_client/meta_client.py Updated Meta API client with full v2/v3 compatibility
src/nocodb_simple_client/table.py Added base_id parameter support to NocoDBTable wrapper
tests/test_version_switching.py Integration tests for API version switching functionality
tests/test_api_version.py Unit tests for PathBuilder and QueryParamAdapter components
tests/test_base_resolver.py Comprehensive tests for BaseIdResolver caching and resolution
examples/api_version_example.py Data API usage examples for both v2 and v3
examples/meta_api_version_example.py Meta API usage examples demonstrating version differences

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 39 to 41
mock_client.get_records.assert_called_once_with(
"test_table_123", None, "(Status,eq,active)", None, 10
"test_table_123", base_id=None, sort=None, where="(Status,eq,active)", fields=None, limit=10
)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

[nitpick] The test assertion uses keyword arguments in a specific order. Consider using a more flexible approach with **kwargs or dict comparison to make the test less brittle to parameter order changes.

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +83
return self.client.get_records(
self.table_id, base_id=base_id, sort=sort, where=where, fields=fields, limit=limit
)
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

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

Method signature maintains backward compatibility by adding base_id as an optional parameter. The implementation correctly passes all parameters using keyword arguments for clarity.

Copilot uses AI. Check for mistakes.
@karlspace karlspace merged commit 4181075 into main Oct 10, 2025
22 of 23 checks passed
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.

1 participant