Expose the page namespace ID through PageIdentifiers and the subject REST API#949
Open
JeroenDeDauw wants to merge 1 commit into
Open
Expose the page namespace ID through PageIdentifiers and the subject REST API#949JeroenDeDauw wants to merge 1 commit into
JeroenDeDauw wants to merge 1 commit into
Conversation
…REST API Follows-up to #946 The page node carries a canonical `namespaceId` (added in #946), but it was only reachable via Cypher. Read code and the subject REST API exposed only the page title (`name`, the content-language prefixed string), so a consumer needing the namespace had to parse that locale-dependent prefix -- the fragility `namespaceId` exists to avoid. This change adds `namespaceId` to the `PageIdentifiers` domain object, reads it from the page node in `Neo4jPageIdentifiersLookup`, and exposes it as `pageNamespaceId` in the GetSubject and GetPageSubjects REST responses, alongside `pageId` and `pageTitle`. `pageNamespaceId` is a canonical, language-independent integer (e.g. 0 main, 12 Help), stable across wikis and content languages. The frontend is unchanged: its only consumer builds same-wiki relation links from `pageTitle` via mw.util.getUrl and does not need the namespace yet. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follows-up to #946
The page node carries a canonical
namespaceId(added in #946), but it was only reachable via Cypher. Read code and the subject REST API exposed only the page title (name, the content-language prefixed string), so a consumer needing the namespace had to parse that locale-dependent prefix — the fragilitynamespaceIdexists to avoid. Since the graph is itself a public surface (users author Cypher against the node properties), the canonical ID belongs on the read/API surface too.This change:
namespaceIdto thePageIdentifiersdomain object;Neo4jPageIdentifiersLookup;pageNamespaceIdin theGetSubjectandGetPageSubjectsREST responses, alongsidepageIdandpageTitle.pageNamespaceIdis a canonical, language-independent integer (e.g.0main,12Help), stable across wikis and content languages.The frontend is unchanged: its only consumer builds same-wiki relation links from
pageTitleviamw.util.getUrland does not need the namespace yet.Verification
Neo4jPageIdentifiersLookupTest(lookup reads the stored ID),GetSubjectQueryTest/GetPageSubjectsQueryTest(query threads it through),GetSubjectApiTest(REST JSON exposespageNamespaceId). Both new behaviours were seen failing via mutation (wrong ID in the lookup; dropped field in the presenter).🤖 Generated with Claude Code