Skip to content

feat: add REST API client with list_databases support#144

Merged
JingsongLi merged 11 commits intoapache:mainfrom
discivigour:rest-api-list-databases
Mar 19, 2026
Merged

feat: add REST API client with list_databases support#144
JingsongLi merged 11 commits intoapache:mainfrom
discivigour:rest-api-list-databases

Conversation

@discivigour
Copy link
Copy Markdown
Contributor

This PR implements the basic REST API client infrastructure and rest mock server, only supporting the list_databases API.

Features:

  • Add REST API client with HTTP request support (GET, GET with params)
  • Add authentication module with Bearer token and NoOp providers
  • Add configuration options for catalog settings
  • Add mock server for testing REST API endpoints
  • Add list_databases and list_databases_paged API methods
  • Add unit tests and integration tests

The Rest catalog has too much code, so it had to be split. This PR is the first one, and other PRs will be submitted continuously afterward.

Purpose

Linked issue: #119

Tests

  • rest_server_test.rs

API and Format

Documentation

umi added 7 commits March 18, 2026 19:39
This PR implements the basic REST API client infrastructure for Paimon
catalog services, focusing on the list_databases API.

Features:
- Add REST API client with HTTP request support (GET, GET with params)
- Add authentication module with Bearer token and NoOp providers
- Add configuration options for catalog settings
- Add mock server for testing REST API endpoints
- Add list_databases and list_databases_paged API methods
- Add unit tests and integration tests

The implementation includes:
- crates/paimon/src/api/: REST API client, response types, error handling
- crates/paimon/src/api/auth/: Authentication providers
- crates/paimon/src/common/: Configuration options
- crates/paimon/src/api/mock_server.rs: Mock server for testing
- crates/paimon/tests/rest_server_test.rs: Integration tests
@discivigour discivigour marked this pull request as ready for review March 19, 2026 07:53
Comment thread crates/paimon/Cargo.toml Outdated
async-stream = "0.3.6"
reqwest = { version = "0.12", features = ["json"] }
tokio-util = "0.7"
axum = { version = "0.7", features = ["macros", "tokio", "http1", "http2"] }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

axum is only used in mock server? If yes, we can add it to dev-dependencies only

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

moved

Seems still in dependencies

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed.

Comment thread crates/paimon/Cargo.toml Outdated
parquet = { workspace = true, features = ["async", "zstd"] }
async-stream = "0.3.6"
reqwest = { version = "0.12", features = ["json"] }
tokio-util = "0.7"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems no usage in code now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed

/// Merge another Options into this one, overwriting existing keys.
pub fn merge(&mut self, other: &Options) {
for (key, value) in &other.data {
self.data.insert(key.clone(), value.clone());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Double check here, user options should be first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changed, use config_response.merge_options().

Comment thread crates/paimon/src/api/rest_util.rs Outdated

#[test]
fn test_encode_decode_string() {
let original = "hello world/测试";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Remove Chinese here and test some string which includes '=' and '&'.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

added

Sorry, my bad. Did you test Chines for purpose? If yes, you can keep it here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I have removed Chinese and added string which includes '=' and '&'.

@XiaoHongbo-Hope
Copy link
Copy Markdown
Contributor

Looks good to me! we can add http retry logic in future PR.

@discivigour
Copy link
Copy Markdown
Contributor Author

Looks good to me! we can add http retry logic in future PR.

ok.

@JingsongLi
Copy link
Copy Markdown
Contributor

+1

@JingsongLi JingsongLi merged commit 952b099 into apache:main Mar 19, 2026
8 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.

3 participants