Skip to content

Conversation

@St0rmingBr4in
Copy link
Contributor

What does this PR do?

Fixes a code generation issue where long scenario names (>120 characters) in Java examples were being word-wrapped incorrectly, causing Java compilation errors.

Problem

When a scenario name exceeds 120 characters, the Jinja2 wordwrap filter was creating a new line without preserving the comment prefix //. This resulted in invalid Java syntax like:

// Validate a detection rule with detection method 'new_value' with enabled feature 'instantaneousBaseline' returns "OK"
response

import com.datadog.api.client.ApiException;

The word response on line 2 is not valid Java syntax, causing compilation errors:

class, interface, enum, or record expected

Solution

Updated the example.j2 template to use the wrapstring parameter in the wordwrap filter:

// {{ scenario.name|wordwrap(width=120, wrapstring='\n// ')}}

This ensures that when the scenario name wraps to a new line, it preserves the // comment prefix, resulting in valid Java code:

// Validate a detection rule with detection method 'new_value' with enabled feature 'instantaneousBaseline' returns
// "OK" response

import com.datadog.api.client.ApiException;

Related PRs

This fixes the compilation errors seen in:

Testing

After this fix is merged, the generated Java examples for PR #3291 should compile successfully.

@St0rmingBr4in St0rmingBr4in requested review from a team as code owners December 10, 2025 13:28
…ments

When scenario names exceed 120 characters, the wordwrap filter was creating
a new line without the comment prefix '//'. This caused Java compilation
errors like 'class, interface, enum, or record expected'.

The fix adds the wrapstring parameter to preserve the comment prefix on
wrapped lines.
@St0rmingBr4in St0rmingBr4in force-pushed the fix-java-example-comment-wordwrap branch from 6f6a754 to 943bd76 Compare December 11, 2025 15:06
@github-actions github-actions bot added the documentation Documentation related changes label Dec 11, 2025
@AxelGeist AxelGeist added the changelog/Fixed Fixed features results into a bug fix version bump label Dec 11, 2025
@AxelGeist
Copy link
Member

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Dec 11, 2025

View all feedbacks in Devflow UI.

2025-12-11 15:11:10 UTC ℹ️ Start processing command /merge


2025-12-11 15:11:18 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-12-11 15:14:45 UTC ℹ️ MergeQueue: This merge request was already merged

This pull request was merged directly.

@AxelGeist AxelGeist merged commit d617bba into master Dec 11, 2025
20 of 21 checks passed
@AxelGeist AxelGeist deleted the fix-java-example-comment-wordwrap branch December 11, 2025 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Fixed Fixed features results into a bug fix version bump documentation Documentation related changes mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants