Skip to content

Support multiline directives in connection file parser#11

Merged
rmorehig merged 3 commits intomainfrom
support-multiline-connection-directives
Mar 23, 2026
Merged

Support multiline directives in connection file parser#11
rmorehig merged 3 commits intomainfrom
support-multiline-connection-directives

Conversation

@gnzjgo
Copy link
Copy Markdown
Member

@gnzjgo gnzjgo commented Mar 23, 2026

Summary

Adds support for multiline directives in the connection file parser, specifically for KAFKA_SSL_CA_PEM with PEM certificates.

Changes

Parser (parse_connection.py):

  • Switched from for loop to index-based while loop
  • Added CONNECTION_DIRECTIVES set and _is_connection_directive_line() predicate
  • When KAFKA_SSL_CA_PEM > is encountered, uses read_directive_block() to collect indented continuation lines
  • Single-line KAFKA_SSL_CA_PEM values continue to work as before

Generator (connection.py):

  • Emits > block syntax with 4-space indentation when ssl_ca_pem contains newlines
  • Single-line values emitted inline as before

Tests: 5 new tests covering:

  • Multiline PEM parsing
  • Multiline with trailing directives (block terminates correctly)
  • Single-line fallback
  • Generator multiline and single-line output

Context

Follows the same approach as the TS SDK: tinybirdco/tinybird-sdk-typescript#129

Closes #10

Add support for the `>` block syntax in the connection parser,
enabling multiline values like KAFKA_SSL_CA_PEM with PEM certificates.

- Switch connection parser from for-each to index-based while loop
- Use read_directive_block() for KAFKA_SSL_CA_PEM > blocks
- Update generator to emit block syntax for multiline values
- Add tests for multiline parsing and generation

Closes #10

Amp-Thread-ID: https://ampcode.com/threads/T-019d1a2d-e5a7-77fb-b97e-e855f84a34a4
Co-authored-by: Amp <amp@ampcode.com>
@gnzjgo gnzjgo requested a review from rmorehig March 23, 2026 12:41
@rmorehig rmorehig merged commit b6a0046 into main Mar 23, 2026
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.

Support multiline directives in connection file parser

2 participants