Skip to content

fix(render): an imported $ref still resolves its object source - #3385

Open
rubenvdlinde wants to merge 1 commit into
developmentfrom
fix/an-imported-ref-still-resolves-its-object-source
Open

fix(render): an imported $ref still resolves its object source#3385
rubenvdlinde wants to merge 1 commit into
developmentfrom
fix/an-imported-ref-still-resolves-its-object-source

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

A property written {"$ref": "nc-organisation"} resolved fine, and silently stopped resolving the moment it had been through an import.

extendObjectSourceRefs() required the ref to be a string. ImportHandler rewrites a $ref slug to the resolved schema id, so what a descriptor ships and what the database ends up holding are different types — and the int form fell straight through the guard to continue.

The property then rendered as its raw uuid with no error anywhere. That is the hard part: the reference looks resolved, because it has an id.

getSchema() has always accepted int|string, so the guard was the only thing rejecting it.

Measured, on one live instance, same publication and same organisation

stored $ref _extend[]=organization returns
"nc-organisation" the organisation, inlined
38 (what the import writes) the raw uuid
38, with this fix the organisation, inlined

Why it matters now

This blocks any leaf app referencing a virtual schema — which is every app about to point publication.organization at OpenRegister's shared organisation (#3363) instead of shipping its own colliding organization schema. I found it while doing exactly that in opencatalogi.

4 regression tests, including the negative cases (empty ref, null, array). tests/Unit/Service/Object: 2,284 tests green. phpcs, phpstan clean.

🤖 Generated with Claude Code

A property written `{"$ref": "nc-organisation"}` resolved fine, and
silently stopped resolving the moment it had been through an import.

extendObjectSourceRefs() required the ref to be a STRING. ImportHandler
rewrites a `$ref` slug to the resolved schema id, so what a descriptor
ships and what the database ends up holding are different types, and the
int form fell straight through the guard to `continue`. The property then
rendered as its raw uuid with no error anywhere: the reference looks
resolved, because it HAS an id.

getSchema() has always accepted `int|string`, so the guard was the only
thing rejecting it.

Measured on a live instance, same publication and same organisation:

  $ref "nc-organisation"  -> inlines the organisation
  $ref 38                 -> returns the raw uuid
  $ref 38, with this fix  -> inlines the organisation

This blocks any leaf app referencing a virtual schema, which is every app
that is about to point `publication.organization` at OpenRegister's
shared organisation rather than shipping its own.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 625d560

Check PHP Vue Security License Tests
lint
phpcs
phpmd
psalm
phpstan
phpmetrics
eslint
stylelint
build
check-specs
test-l10n
test-l10n-parity
format
check-schema-l10n
check-l10n-js
composer ✅ 174/174
npm ✅ 543/543
app:check-code ⏭️
info.xml
REUSE
PHPUnit
Newman
Playwright ⏭️ deferred — runs on the promotion into beta/main, not on a pull request into development
Hydra gates

Quality workflow — 2026-09-03 18:28 UTC

Download the full PDF report from the workflow artifacts.

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