Skip to content

docs: clarify fluent API guideline rationale - #38811

Merged
mergify[bot] merged 1 commit into
mainfrom
alvazjor/fluent-api-guideline-rationale
Sep 11, 2026
Merged

mergify[bot] merged 1 commit into
mainfrom
alvazjor/fluent-api-guideline-rationale

Conversation

@alvazjor

@alvazjor alvazjor commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Reason for this change

The stated rationale for the no-fluent-API rule was wrong. It claimed jsii languages cannot chain methods that return this, but chaining works fine in all jsii targets (verified in Python, Java, C#, and Go). The actual reason is API consistency: the library configures through props objects at construction time.

Description of changes

Correct the rationale and soften the rule from a hard prohibition to SHOULD NOT, in both docs/DESIGN_GUIDELINES.md and AGENTS.md. A fluent API is now allowed with a written justification, accepted at maintainer discretion.

Description of how you validated changes

Docs-only change.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

The stated reason for the no-fluent-API rule was incorrect: jsii handles
method chaining that returns `this` in all target languages (verified in
Python, Java, C#, and Go). The real reason is API consistency, since the
library configures through props objects at construction time.

Soften the rule to SHOULD NOT with a written-justification requirement,
accepted at maintainer discretion, and correct the rationale in both the
design guidelines and AGENTS.md.
@github-actions github-actions Bot added the p2 label Sep 11, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team September 11, 2026 09:53
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Sep 11, 2026
@mergify
mergify Bot deployed to automation September 11, 2026 09:53 Active
@mergify
mergify Bot deployed to automation September 11, 2026 09:54 Active
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ This pull request description does not follow the correct template structure.

PRs without a linked issue will receive lower priority for review and merging. Please update the description to follow the PR template and include a line like Closes #123 in the Issue section. If no existing issue matches your change, create one first.

@maintainer-for-aws

Copy link
Copy Markdown

Automated review

A maintainer will still review this — treat the notes below as a starting point.

This docs-only PR clarifies the CDK design guideline on fluent APIs across two files. In docs/DESIGN_GUIDELINES.md, the terse "No fluent APIs" bullet is expanded into a paragraph reframing the rule as a consistency preference (configure through props objects; chaining that returns this reserves the method's return value), with a PolicyStatement example and a written-justification-at-maintainer-discretion clause. In AGENTS.md, the corresponding anti-pattern bullet is softened from MUST NOT to SHOULD NOT and re-explained on the same consistency basis, instructing that a discovered fluent API be surfaced as a warning rather than a blocking issue. The two documents are consistent with each other, keep the #general-principles cross-reference intact, and the PolicyStatement example accurately reflects the real props-based API. No issues found on this change.

🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional


Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.

@alvazjor

Copy link
Copy Markdown
Contributor Author

@Mergifyio queue

@mergify

mergify Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-09-11 14:00 UTC · Rule: default-squash · triggered by @alvazjor with the @mergifyio queue command
  • ✅ Checks skipped · PR is already up-to-date
  • ✅ Merged — 2026-09-11 14:00 UTC · at aa360a66e08207d8f587cac208595fce0e22549b · squash

This pull request spent 26 seconds in the queue, including 2 seconds running CI.

Required conditions to merge

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
mergify Bot merged commit aa360a6 into main Sep 11, 2026
47 of 48 checks passed
@mergify
mergify Bot deleted the alvazjor/fluent-api-guideline-rationale branch September 11, 2026 14:00
@github-actions

Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 11, 2026

This branch was successfully deployed

1 active deployment
automation — cec95975 Deployed Sep 11, 2026 by mergify[bot] via validate-pr #367313
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants