Skip to content

fix(declarative): route RequestBodyPlainText to request_body_data instead of request_body_json#930

Draft
Vai Ignatavicius (vai-airbyte) wants to merge 1 commit intomainfrom
devin/1772643208-fix-request-body-plain-text
Draft

fix(declarative): route RequestBodyPlainText to request_body_data instead of request_body_json#930
Vai Ignatavicius (vai-airbyte) wants to merge 1 commit intomainfrom
devin/1772643208-fix-request-body-plain-text

Conversation

@vai-airbyte
Copy link

@vai-airbyte Vai Ignatavicius (vai-airbyte) commented Mar 4, 2026

fix(declarative): route RequestBodyPlainText to request_body_data

Summary

RequestBodyPlainText was incorrectly grouped with RequestBodyJsonObject in _resolve_request_body(), causing its string value to be routed to request_body_json. This produced a ValueError("Request body json cannot be a string") whenever a user configured a plain text request body in connector builder.

The fix separates RequestBodyPlainText from RequestBodyJsonObject and routes it to request_body_data, which correctly handles string payloads.

Before (broken):

elif self.request_body.type in ("RequestBodyJsonObject", "RequestBodyPlainText"):
    self.request_body_json = self.request_body.value  # string → ValueError downstream

After (fixed):

elif self.request_body.type == "RequestBodyJsonObject":
    self.request_body_json = self.request_body.value
elif self.request_body.type == "RequestBodyPlainText":
    self.request_body_data = self.request_body.value  # string → sent as plain text body

Review & Testing Checklist for Human

  • Verify no published connectors rely on the old (buggy) RequestBodyPlainText → JSON behavior. The old code routed RequestBodyPlainText through request_body_json, which would parse JSON-like strings into dicts. If any existing connector accidentally depends on this, this fix changes their behavior. Search for RequestBodyPlainText usage across published connector manifests.
  • Test the original repro in connector builder: Use the attached test_xml_repro.yaml (POST with RequestBodyPlainText value "\"Hi\"") and confirm the "Request body json cannot be a string" error no longer occurs.
  • Verify the removed test case was testing incorrect behavior: The old test_string case in test_interpolated_request_json_using_request_body asserted that RequestBodyPlainText with a JSON string would be parsed as a JSON dict — that was validating the bug, not correct behavior.

Notes


Open with Devin

…st_body_json

RequestBodyPlainText was incorrectly grouped with RequestBodyJsonObject in
_resolve_request_body, causing plain text body values to be routed to
request_body_json. This caused a ValueError('Request body json cannot be
a string') when using RequestBodyPlainText in connector builder.

The fix routes RequestBodyPlainText to request_body_data, which correctly
handles string payloads as plain text request bodies.

Co-Authored-By: Vai Ignatavicius <vaidotas.ignatavicius@airbyte.io>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

💡 Show Tips and Tricks

Testing This CDK Version

You can test this version of the CDK using the following:

# Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1772643208-fix-request-body-plain-text#egg=airbyte-python-cdk[dev]' --help

# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1772643208-fix-request-body-plain-text

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /autofix - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test - Runs connector tests with the updated CDK
  • /prerelease - Triggers a prerelease publish with default arguments
  • /poe build - Regenerate git-committed build artifacts, such as the pydantic models which are generated from the manifest JSON schema in YAML.
  • /poe <command> - Runs any poe command in the CDK environment
📚 Show Repo Guidance

Helpful Resources

📝 Edit this welcome message.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

PyTest Results (Fast)

3 870 tests  +1   3 858 ✅ +1   7m 34s ⏱️ +43s
    1 suites ±0      12 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit ab6a227. ± Comparison against base commit 7f41401.

This pull request removes 4 and adds 5 tests. Note that renamed tests count towards both.
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_graphql_query-input_request_json13-expected_request_json13]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_nested_objects-input_request_json11-expected_request_json11]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_nested_objects_interpolated keys-input_request_json12-expected_request_json12]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_string-input_request_json10-expected_request_json10]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_data_using_request_body[test_plain_text_static_value-input_request_data5-plain text body]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_data_using_request_body[test_plain_text_with_interpolation-input_request_data6-OPTION]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_graphql_query-input_request_json12-expected_request_json12]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_nested_objects-input_request_json10-expected_request_json10]
unit_tests.sources.declarative.requesters.request_options.test_interpolated_request_options_provider ‑ test_interpolated_request_json_using_request_body[test_nested_objects_interpolated keys-input_request_json11-expected_request_json11]

@github-actions
Copy link

github-actions bot commented Mar 4, 2026

PyTest Results (Full)

3 873 tests   3 861 ✅  11m 29s ⏱️
    1 suites     12 💤
    1 files        0 ❌

Results for commit ab6a227.

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