Skip to content

feat: import recipe from schema.org JSON - #3430

Open
TheTisiboth wants to merge 17 commits into
nextcloud:masterfrom
TheTisiboth:feat/import-json-recipe
Open

TheTisiboth wants to merge 17 commits into
nextcloud:masterfrom
TheTisiboth:feat/import-json-recipe

Conversation

@TheTisiboth

@TheTisiboth TheTisiboth commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Topic and Scope

Closes #1872
Depends on #3507

Depends on #3454

Adds a way to create a recipe by pasting schema.org JSON.

  • New side bar entry "Import recipe from JSON". It opens a dialog with a text box.
  • It accepts a JSON object whose @type is Recipe (which can be wrapped with a <script> tag
  • Sends the JSON to /import (new json field); parsing happens in the backend with the URL-import parser
  • If a recipe has no url, the page URL from mainEntityOfPage is used as source

Screenshots

image

Concerns/issues

  • This comment proposed to reuse the url input field to also paste the JSON, but the UX would be bad as we couldn't see the whole pasted JSON, this is why I thought about creating a new modal to show it better.
  • The API changes (new json field on /import). I added an entry to the API changelog under "Unpublished", but did not touch the OpenAPI spec, since the versioned folders are created at release. Should I add it to a new 0.1.4 spec, or will you handle it at release?

Formal requirements

There are some formal requirements that should be satisfied. Please mark those by checking the corresponding box.

  • I did check that the app can still be opened and does not throw any browser logs
  • I created tests for newly added PHP code (check this if no PHP changes were made)
  • I updated the OpenAPI specs and added an entry to the API changelog (check if API was not modified)
  • I notified the matrix channel if I introduced an API change

AI assistance

I used AI to help me run the investigation, to check if this feature didn't exist yet, generate the code and tests

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

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

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fe686c93-cad0-4885-8ad3-aa6b6265bf6b
📥 Commits

Reviewing files that changed from the base of the PR and between 2792967 and d5f2fe1.

📒 Files selected for processing: 2
  • lib/Helper/Filter/JSON/FixUrlFilter.php
  • tests/Unit/Helper/Filter/JSON/FixUrlFilterTest.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

Walkthrough

The change adds JSON-LD recipe parsing and supports importing JSON through the existing recipe API. The import dialog accepts JSON input, submits it, displays errors, and opens the imported recipe after a successful response. The parser handles optional script tags and searches graph data for recipes. Tests cover parsing cases, schema.org contexts, URL extraction, and controller responses.

Priority: Low

Merge Risk: Low · previous review d5f2f

The JSON recipe import works for the URL fallback cases. One earlier parsing concern is still unresolved: some nested graph inputs may be rejected because their schema context comes from the outer graph. This is a limited edge case and is fine to merge with owner awareness.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 56.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 37 functions across 14 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue [#1872] requires a web UI that accepts pasted recipe JSON. AppNavi opens ImportJsonDialog, and the dialog submits JSON through recipes.importJson. The /import controller path, `RecipeSer…
Out of Scope Changes check Passed The changed files support [#1872]. Navigation and dialog files implement the UI. API handling, backend parsing, URL fallback, API documentation, and tests support direct JSON recipe import. No unrelat…
Title check Passed The title clearly and concisely describes the primary change: importing recipes from schema.org JSON.
Description check Passed The description covers the scope, user interface, API behavior, fallback URL handling, concerns, screenshots, tests, API documentation, and formal requirements. It is complete and aligned with the cha…
Full details: Linked Issues check

Explanation

Issue [#1872] requires a web UI that accepts pasted recipe JSON. AppNavi opens ImportJsonDialog, and the dialog submits JSON through recipes.importJson. The /import controller path, RecipeService::importRecipeJson, and HttpJsonLdParser::parseJsonLd implement the import. Tests cover controller handling, JSON-LD parsing, script-tag input, context handling, and URL fallback.

Full details: Out of Scope Changes check

Explanation

The changed files support [#1872]. Navigation and dialog files implement the UI. API handling, backend parsing, URL fallback, API documentation, and tests support direct JSON recipe import. No unrelated change is demonstrated by the available evidence.

Full details: Description check

Explanation

The description covers the scope, user interface, API behavior, fallback URL handling, concerns, screenshots, tests, API documentation, and formal requirements. It is complete and aligned with the changes.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@TheTisiboth
TheTisiboth force-pushed the feat/import-json-recipe branch from 5b64a1c to 516f64f Compare October 9, 2026 14:58
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   12 files    612 suites   2m 40s ⏱️
  633 tests   625 ✅  8 💤 0 ❌
2 532 runs  2 499 ✅ 33 💤 0 ❌

Results for commit 8defae9.

♻️ This comment has been updated with latest results.

@TheTisiboth

TheTisiboth commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

The branch comes from a forked repo, this is maybe why the label job is failing? (branch is read only)

@christianlupus

Copy link
Copy Markdown
Collaborator

The failing check is known: nextcloud/.github#767

@christianlupus christianlupus added the AI assisted This PR contains AI-assisted commits label Oct 9, 2026
@christianlupus

Copy link
Copy Markdown
Collaborator

I just checked out the code and gave it a spin. Unfortunately, my first try to import a recipe failed. I took randomly a recipe from a website, extracted the JSON and fed that into the frame. For convinience, I copy the content into the following verbatim text:

[{"@context":"https://schema.org","@graph":[{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#recipe","@type":"Recipe","aggregateRating":{"@type":"AggregateRating","bestRating":5,"ratingCount":732,"ratingValue":4.49,"worstRating":0},"alternativeHeadline":"Fett- und kalorienarm, schnell und sehr einfach","author":{"@id":"https://www.chefkoch.de/user/profil/98d8cb175968bdd9e846baa986d4b6da#author"},"comment":[{"@type":"Comment","author":{"@id":"https://www.chefkoch.de/user/profil/83d0d60bf611b8a2a19e14d89f1b2a68#author","@type":"Person","name":"AR53"},"datePublished":"2026-10-09","text":"Korrektur, sorry!\nEs sollte natürlich heissen „Mascarpone“ und nicht Marscapone.🤨"},{"@type":"Comment","author":{"@id":"https://www.chefkoch.de/user/profil/b9cbe56bef293b8ae6a03e46c456d2a5#author","@type":"Person","name":"Möppie"},"datePublished":"2016-07-08","text":"Lecker, habe noch etwas Muskatnuss und Zitrone dran gemacht sowie eine Prise Zucker. Meine Kinder (Brokkoli- und Kartoffelverächter) lieben sie - ich verkaufe sie mit einem fiesen Lachen als Hexensuppe mit Drachenschleim ;-) Liebe Grüsse ","upvoteCount":25},{"@type":"Comment","author":{"@id":"https://www.chefkoch.de/user/profil/d1c961196d3ba63c5d0921e34d280f9a#author","@type":"Person","name":"Ich2312"},"datePublished":"2025-01-03","text":"Mache Sie auch so nur eben auch mit Zwiebel  und Knoblauch. Gemüsebrühe  Salz Pfeffer Muskat etwas Curry ne butterflocke und n Schuss  Sahne...Jammi","upvoteCount":11}],"commentCount":316,"cookTime":"PT30M","dateModified":"2026-10-09","datePublished":"2006-12-04","description":"Brokkolisuppe - fett- und kalorienarm, schnell und sehr einfach. Über 732 Bewertungen und für mega befunden. Mit ► Portionsrechner ► Kochbuch ► Video-Tipps!","image":{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#primaryimage"},"inLanguage":"de-DE","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":316}],"keywords":"Gemüse, Vorspeise, Suppe, warm, gebunden, einfach, kalorienarm, fettarm, gekocht","mainEntityOfPage":{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html"},"name":"Brokkolisuppe von jesusfreak","nutrition":{"@type":"NutritionInformation","calories":"141 kcal","carbohydrateContent":"17 g","fatContent":"4.5 g","proteinContent":"7.7 g","servingSize":"1 Portion"},"prepTime":"PT15M","publisher":{"@id":"https://www.chefkoch.de/#organization"},"recipeCategory":"Vegetarisch","recipeCuisine":"Deutsch","recipeIngredient":["500 g Brokkoli","2 große Kartoffel(n)","1 Liter Gemüsebrühe","Salz und Pfeffer"],"recipeInstructions":[{"@type":"HowToSection","itemListElement":[{"@type":"HowToStep","position":1,"text":"Die Kartoffeln in kleine Stücke schneiden. ","url":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#step1"},{"@type":"HowToStep","position":2,"text":"Den Brokkoli und die Kartoffelstücke in der Brühe etwa 20 Minuten köcheln lassen, bis beides weich ist. Mit dem Mixstab pürieren oder alles in den Mixer geben. Wieder in den Topf zurückgeben und nochmals erwärmen. Dann mit Salz und Pfeffer abschmecken.  Tipp: Zum Verfeinern evtl. noch 100 ml Sahne oder Pflanzensahne unterrühren, dann ist die Suppe allerdings auch etwas fettreicher.","url":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#step2"}],"name":"Zubereitung"}],"recipeYield":["4","4 Portionen"],"suitableForDiet":"https://schema.org/VegetarianDiet","totalTime":"PT45M","video":[{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#video"}]},{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#video","@type":"VideoObject","contentUrl":"https://img.chefkoch-cdn.de/ck.de/videos/4272-video.mp4","description":"Video zu Brokkolisuppe - fett- und kalorienarm, schnell und sehr einfach","duration":"PT33S","inLanguage":"de-DE","name":"Schnelle Brokkolisuppe","thumbnailUrl":"https://img.chefkoch-cdn.de/rezepte/642141165243156/bilder/1334973/crop-960x540/brokkolisuppe.jpg","uploadDate":"2020-09-10T00:00:00.000Z"},{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html","@type":"WebPage","author":{"@id":"https://www.chefkoch.de/user/profil/98d8cb175968bdd9e846baa986d4b6da#author"},"breadcrumb":{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#breadcrumb"},"dateModified":"2026-10-09","datePublished":"2006-12-04","description":"Brokkolisuppe - fett- und kalorienarm, schnell und sehr einfach. Über 732 Bewertungen und für mega befunden. Mit ► Portionsrechner ► Kochbuch ► Video-Tipps!","inLanguage":"de-DE","isPartOf":{"@id":"https://www.chefkoch.de/#website"},"mainEntity":{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#recipe"},"name":"Brokkolisuppe von jesusfreak","primaryImageOfPage":{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#primaryimage"},"publisher":{"@id":"https://www.chefkoch.de/#organization"},"url":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html"},{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#primaryimage","@type":"ImageObject","contentUrl":"https://img.chefkoch-cdn.de/rezepte/642141165243156/bilder/1334973/crop-960x540/brokkolisuppe.jpg","height":540,"url":"https://img.chefkoch-cdn.de/rezepte/642141165243156/bilder/1334973/crop-960x540/brokkolisuppe.jpg","width":960},{"@id":"https://www.chefkoch.de/rezepte/642141165243156/Brokkolisuppe.html#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","item":"https://www.chefkoch.de/","name":"Startseite","position":1},{"@type":"ListItem","item":"https://www.chefkoch.de/rezepte/","name":"Rezepte","position":2},{"@type":"ListItem","item":"https://www.chefkoch.de/rs/s0g32/Speisearten.html","name":"Spezielles","position":3},{"@type":"ListItem","item":"https://www.chefkoch.de/rs/s0t6082/Ernaehrungskonzepte-Rezepte.html","name":"Ernährungskonzepte","position":4},{"@type":"ListItem","item":"https://www.chefkoch.de/rs/s0t32/Vegetarisch-Rezepte.html","name":"Vegetarisch","position":5}]},{"@id":"https://www.chefkoch.de/#website","@type":"WebSite","inLanguage":"de-DE","name":"Chefkoch","publisher":{"@id":"https://www.chefkoch.de/#organization"},"url":"https://www.chefkoch.de/"},{"@id":"https://www.chefkoch.de/#organization","@type":"Organization","logo":{"@type":"ImageObject","height":144,"url":"https://img.chefkoch-cdn.de/img/ck.de/ck-logo-de.png","width":144},"name":"Chefkoch","sameAs":["https://www.facebook.com/chefkoch.de","https://www.instagram.com/chefkoch/","https://www.youtube.com/chefkoch","https://de.pinterest.com/chefkochde/","https://www.tiktok.com/@chefkoch","https://www.whatsapp.com/channel/0029VabvqZU3LdQOknGWyl1H"],"url":"https://www.chefkoch.de/"},{"@id":"https://www.chefkoch.de/user/profil/98d8cb175968bdd9e846baa986d4b6da#author","@type":"Person","name":"jesusfreak","url":"https://www.chefkoch.de/user/profil/98d8cb175968bdd9e846baa986d4b6da"}]}]

I think the problem is the rather minimalistic Schema.org parser/validator. However, it might be a good idea in my mind to keep the parser in one location, backend or frontend. We will need it in the backend anyways, so if we filter in the frontend as well, this might rule out some content/JSON structures that would otherwise work.

Is there a reason for not directly storing it in the backend (just asking, maybe I overlooked something)?

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (3)
tests/Unit/Service/RecipeExtractionServiceTest.php (1)

89-90: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fix the PHPDoc @var tag to remove the PHPStan error.

createMock() returns MockObject&HttpJsonLdParser. PHPStan reports varTag.nativeType for the union tag. Use an intersection type.

Proposed fix
-		/** @var HttpJsonLdParser|MockObject $jsonParser */
+		/** @var HttpJsonLdParser&MockObject $jsonParser */

Source: Linters/SAST tools

lib/Service/RecipeService.php (1)

377-385: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add the missing checkRecipe step and a docblock.

downloadRecipe calls checkRecipe before addRecipe. addRecipe also calls checkRecipe, so the behavior is safe. The method still lacks a docblock. Add one that lists the ImportException and the recipe-exists exception.

lib/Controller/Implementation/RecipeImplementation.php (1)

324-340: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Request with both url and json silently ignores json.

When a client sends both fields, the code takes the URL path. This is acceptable. Document the precedence in the API spec and changelog.

A non-string url still reaches isDownloadUrlValid(string $url). That behavior existed before this change.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99f929e6-984c-4937-9007-c1b5fd4c8ed7
📥 Commits

Reviewing files that changed from the base of the PR and between 516f64f and 7cc5d29.

📒 Files selected for processing (12)
  • docs/dev/api/changelog/0.md
  • lib/Controller/Implementation/RecipeImplementation.php
  • lib/Helper/HTMLParser/HttpJsonLdParser.php
  • lib/Service/JsonService.php
  • lib/Service/RecipeExtractionService.php
  • lib/Service/RecipeService.php
  • src/components/Modals/ImportJsonDialog.vue
  • src/js/api-interface.js
  • tests/Unit/Controller/Implementation/RecipeImplementationTest.php
  • tests/Unit/Helper/HTMLParser/HttpJsonLdParserTest.php
  • tests/Unit/Service/JsonServiceTest.php
  • tests/Unit/Service/RecipeExtractionServiceTest.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread src/components/Modals/ImportJsonDialog.vue

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

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

⚠️ Outside diff range comments (1)

🟡 Minor · Preserve the schema context when searching a nested graph. · HttpJsonLdParser.php:191

lib/Helper/HTMLParser/HttpJsonLdParser.php:191
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve the schema context when searching a nested graph.

If an outer graph supplies @context and an inner graph omits it, mapGraphField($item) finds the inner Recipe without copying the outer context. searchForRecipeInArray then checks that Recipe with $haveSchemaContext = true, but parseJsonLd later requires the Recipe to contain its own context. The import fails with “No recipe was found.” Pass the inherited context into the nested search or copy it onto the selected Recipe.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d8be6b51-ad88-46ce-8dfe-f89d093a237c
📥 Commits

Reviewing files that changed from the base of the PR and between 7cc5d29 and 3912380.

📒 Files selected for processing (3)
  • lib/Helper/HTMLParser/HttpJsonLdParser.php
  • lib/Service/RecipeService.php
  • tests/Unit/Helper/HTMLParser/HttpJsonLdParserTest.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Comment thread lib/Service/RecipeService.php Outdated
@TheTisiboth

TheTisiboth commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for testing.
I didn't think of this JSON type: i just tested on the one from the issue: now I made the code more resilient to be compatible with more kind of inputs (script tag, array, etc), and there is no good reason for parsing it in the FE:
Now it is parsing it in the backend, reusing HttpJsonLdParser from URL import (#DRY). And should I update the OpenAPI spec / bump the API version for the new field?

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
…recipe

Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
@TheTisiboth

Copy link
Copy Markdown
Collaborator Author

open api specs has been updated, and coderabbittai review is handled

@TheTisiboth

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b10edbfe-74fb-489c-847b-85d5594bfb68
📥 Commits

Reviewing files that changed from the base of the PR and between 3f5b48c and d3eaf92.

📒 Files selected for processing: 8
  • docs/dev/api/trunk/internal-cookbook.yaml
  • docs/dev/api/trunk/objects.yaml
  • docs/dev/api/trunk/openapi-cookbook.yaml
  • lib/Helper/Filter/JSON/FixUrlFilter.php
  • lib/Helper/HTMLParser/HttpJsonLdParser.php
  • lib/Service/RecipeService.php
  • tests/Unit/Helper/Filter/JSON/FixUrlFilterTest.php
  • tests/Unit/Helper/HTMLParser/HttpJsonLdParserTest.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Comment thread docs/dev/api/trunk/internal-cookbook.yaml Outdated
Comment thread docs/dev/api/trunk/openapi-cookbook.yaml
Comment thread lib/Helper/HTMLParser/HttpJsonLdParser.php Outdated
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
@TheTisiboth

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Extract mainEntityOfPage.url before sanitizing it. · FixUrlFilter.php:40-51

lib/Helper/Filter/JSON/FixUrlFilter.php:40-51
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Extract mainEntityOfPage.url before sanitizing it.

A valid schema.org WebPage can contain url without @id. The current fallback assigns the complete WebPage object to url. filter_var() returns false for that array, and the next validation replaces it with an empty string. The import then persists no source URL.

Suggested fix
-			$json[self::URL] = $json['mainEntityOfPage']['@id'] ?? $json['mainEntityOfPage'];
+			$json[self::URL] = $json['mainEntityOfPage']['@id'] ?? $json['mainEntityOfPage']['url'] ?? $json['mainEntityOfPage'];

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c9db9b65-d858-4fe4-8dbb-a78b047004dd
📥 Commits

Reviewing files that changed from the base of the PR and between d3eaf92 and 2792967.

📒 Files selected for processing: 4
  • docs/dev/api/trunk/internal-cookbook.yaml
  • docs/dev/api/trunk/openapi-cookbook.yaml
  • lib/Helper/HTMLParser/HttpJsonLdParser.php
  • tests/Unit/Helper/HTMLParser/HttpJsonLdParserTest.php

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Léo Jan <thetisiboth@gmail.com>
@TheTisiboth

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Merge origin/master into feat/import-json-recipe.
URL string validation and trimming from master are guarded
behind isset($data['url']) to preserve JSON-only import path.
Both new imports (HttpJsonLdParser, ImageConversionHelper)
and constructor params are kept.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Léo Jan <leo.jan@doctolib.com>
@github-actions

Copy link
Copy Markdown
Contributor

…cipe

Signed-off-by: Léo Jan <leo.jan@doctolib.com>
@TheTisiboth
TheTisiboth enabled auto-merge (squash) October 27, 2026 22:35

@christianlupus christianlupus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I did not yet find the time to give it a complete review yet. However, I wanted to give one point, that will cause trouble, to be honest: the openAPI spec is not as required by the specs.

Comment thread docs/dev/api/trunk/internal-cookbook.yaml Outdated
Comment thread docs/dev/api/trunk/openapi-cookbook.yaml Outdated
TheTisiboth and others added 2 commits October 29, 2026 23:57
Assisted-by: Claude Code:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Léo Jan <leo.jan@doctolib.com>
Assisted-by: Claude Code:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Léo Jan <leo.jan@doctolib.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add ui to directly import JSON

2 participants