zeguilherme99 opened a new pull request, #12424:
URL: https://github.com/apache/seatunnel/pull/12424
### Purpose of this pull request
Related to #11007.
This PR implements the connector-tablestore source-and-sink declarative
validation slice.
**What changed**
- Preserve the existing source and sink required/optional structure. No
option is renamed, no default or type changes, no runtime code changes.
- Add `Conditions.notBlank(...)` to the already-required string options in
both factories: `end_point`, `instance_name`, `access_key_id`,
`access_key_secret`, `table`.
- Add `Conditions.notEmpty(...)` to the already-required `primary_keys` list
option in both factories.
- Register `schema` as required in `TableStoreSourceFactory`. The sink
factory already registers it, the source docs already list it as required, and
`TableStoreSource` builds its catalog table from it via
`CatalogTableUtil.buildWithConfig`, so a source config without `schema`
previously passed `--check` and failed at runtime.
- Replace the placeholder factory test with focused source and sink
validation coverage.
- Update the EN/ZH source and sink docs with the non-blank / non-empty rules.
**Deliberately kept as runtime behavior (not migrated)**
- `batch_size` stays optional with its default of `25` and no numeric
constraint. The writer currently treats `batch_size <= 0` as "flush only on
close", so adding a lower bound would change accepted configurations.
- The source-side rule that `primary_keys` must have the same number of
entries as the comma-separated `table` list. It is expressible with a
`ConditionExtension`, but it is a cross-field structural rule and out of scope
for this slice.
- Client construction, connectivity, credential checks, and serializer type
errors are untouched.
**Registered options after this change**
| Factory | Required | Optional |
| --- | --- | --- |
| Source | `end_point`, `instance_name`, `access_key_id`,
`access_key_secret`, `table` (non-blank); `primary_keys` (non-empty); `schema`
| - |
| Sink | `end_point`, `instance_name`, `access_key_id`, `access_key_secret`,
`table` (non-blank); `primary_keys` (non-empty); `schema` | `batch_size` |
### Does this PR introduce _any_ user-facing change?
Yes.
Empty or whitespace-only values for `end_point`, `instance_name`,
`access_key_id`, `access_key_secret`, or `table`, and an empty `primary_keys`
list, are now rejected during connector option validation (`--check`) instead
of failing when the Tablestore client or serializer runs. A Tablestore source
config without `schema` is now rejected at validation time instead of at
runtime.
All existing valid configurations are unchanged. No
`incompatible-changes.md` entry is needed because every rejected configuration
already failed at runtime.
### How was this patch tested?
`TableStoreFactoryTest` was replaced with focused `ConfigValidator` coverage
for both source and sink option rules:
- valid single-table and multi-table source configurations;
- valid sink configurations with and without `batch_size`;
- each required option individually missing;
- empty and whitespace-only values for each required string option;
- empty `primary_keys` list;
- source and sink configurations without `schema`;
- each rejection asserts the option key is present in the error message.
Run locally with JDK 11:
```
./mvnw -pl seatunnel-connectors-v2/connector-tablestore spotless:apply
./mvnw -pl seatunnel-connectors-v2/connector-tablestore test
./mvnw -pl seatunnel-connectors-v2/connector-tablestore -DskipTests verify
```
There is no Tablestore E2E module, so no IT was added.
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License
Notice according
[New License
Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/developer/new-license.md)
* [x] If necessary, please update the documentation to describe the new
feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If necessary, please update `incompatible-changes.md` to describe the
incompatibility caused by this PR.
* [ ] If you are contributing the connector code, please check that the
following files are updated:
1. Update
[plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties)
and add new connector information in it
2. Update the pom file of
[seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in
[label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in
[seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector
[plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]