Skip to content

Allow steps to contain both DataTable and DocString#599

Open
kruczekrobert wants to merge 1 commit into
cucumber:mainfrom
kruczekrobert:allow-step-datatable-docstring
Open

Allow steps to contain both DataTable and DocString#599
kruczekrobert wants to merge 1 commit into
cucumber:mainfrom
kruczekrobert:allow-step-datatable-docstring

Conversation

@kruczekrobert
Copy link
Copy Markdown

@kruczekrobert kruczekrobert commented May 27, 2026

🤔 What's changed?

This change allows a single Gherkin step to contain both a DataTable and a DocString.

Previously, the grammar/parser treated Step DataTable and Step DocString as mutually exclusive alternatives. This updates the grammar and generated parsers so a step can include both argument types, and updates the AST/pickle compilation path across implementations to preserve both values.

Added testdata coverage for:

  • a valid step containing both a DataTable and a DocString
  • the existing invalid case where a step contains repeated DocStrings

⚡️ What's your motivation?

Some step definitions can naturally need both structured tabular input and a larger text payload. Gherkin already supports both argument types independently, but the grammar currently prevents using them together on the same step.

This proposal makes that combination representable directly in Gherkin instead of requiring workarounds such as encoding one argument inside the other.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

I would appreciate feedback on whether allowing both DataTable and DocString on a single step is acceptable from the Gherkin language/design perspective.

I would also like reviewers to check whether the AST and pickle representation chosen here is the right compatibility trade-off across the supported implementations.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

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