Skip to content

Simplify the WriteApi request path after removing the OpenAPI client #229

Description

@bednar

Context

PR #217 removed the generated ApiClient, Configuration, and WriteService classes and introduced the internal RestClient.

The write implementation still contains generated OpenAPI request plumbing in influxdb_client_3/write_client/client/write_api.py. This makes the write path harder to maintain and leaves v2-specific generated behavior in a v3 client.

Scope

Simplify the internal WriteApi request path into three focused steps:

serialize(record)
build_write_request(...)
rest_client.request(...)

Remove or consolidate:

  • _post_write_prepare;
  • call_api;
  • _check_operation_params;
  • _sanitize_for_serialization;
  • duplicated request preparation logic;
  • stale generated v2 API documentation.

The refactor must preserve the current write behavior:

  • v2: /api/v2/write, bucket, short precision values;
  • v3: /api/v3/write_lp, db, long precision values;
  • no_sync and accept_partial only for the v3 endpoint;
  • gzip, timeout, retry, proxy, TLS, and error translation behavior.

Add or update tests for the v2/v3 request matrix and the existing error cases.

Acceptance criteria

  • All existing unit and integration tests pass.
  • Request construction is covered for both v2 and v3 endpoints.
  • No references to the removed ApiClient, Configuration, or WriteService remain in the write implementation.
  • The write path no longer depends on generic generated OpenAPI request helpers.
  • Endpoint selection remains centralized.
  • No second HTTP transport abstraction is introduced.
  • No public API changes are introduced.

Out of scope

  • Adding new InfluxDB endpoints.
  • WritePrecision.AUTO.
  • Redesigning batching or RxPY.
  • Moving or renaming RestClient.
  • Changes to the query transport.
  • Removing or deprecating publicly reachable methods such as post_write_async; that requires a separate decision.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions