Skip to content

Commit 15eb267

Browse files
author
Sagar Miglani
committed
feat: page relationships api in case of MSM and lang copies
1 parent 7c196b9 commit 15eb267

File tree

8 files changed

+770
-444
lines changed

8 files changed

+770
-444
lines changed

docs/openapi/api.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ paths:
212212
$ref: './sites-api.yaml#/site-brand-profile'
213213
/sites/{siteId}/config/cdn-logs:
214214
$ref: './site-api.yaml#/site-cdn-logs-config'
215+
/sites/{siteId}/page-relationships/search:
216+
$ref: './site-api.yaml#/site-page-relationships-search'
215217
/sites/{siteId}/opportunities:
216218
$ref: './site-opportunities.yaml#/site-opportunities'
217219
/sites/{siteId}/opportunities/by-status/{status}:

docs/openapi/examples.yaml

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,4 +631,85 @@ customer-config-v2-patch:
631631
origin: "manual"
632632
source: "api"
633633
categoryId: "859b91c5-0420-4f3b-a464-8d6f6ac34f64"
634-
topicId: "topic-acrobat-features"
634+
topicId: "topic-acrobat-features"
635+
636+
page-relationships-search-request:
637+
description: Example request body for on-demand page relationship search
638+
value:
639+
pages:
640+
- key: "row-1"
641+
pageUrl: "/de/de/adventures"
642+
suggestionType: "Missing Title"
643+
- key: "row-2"
644+
pageUrl: "/us/en/adventures/camping"
645+
suggestionType: "Missing Description"
646+
647+
page-relationships-search-response:
648+
description: Relationship lookup response with resolved relationships
649+
value:
650+
supported: true
651+
relationships:
652+
"row-1":
653+
pagePath: "/de/de/adventures"
654+
pageId: "123e4567-e89b-12d3-a456-426614174000"
655+
chain:
656+
- pageId: "123e4567-e89b-12d3-a456-426614174010"
657+
pagePath: "/content/site/language-masters/de/adventures"
658+
metadata:
659+
sourceType: "liveCopyOf"
660+
- pageId: "123e4567-e89b-12d3-a456-426614174011"
661+
pagePath: "/content/site/language-masters/en/adventures"
662+
metadata:
663+
sourceType: "langCopyOf"
664+
"row-2":
665+
pagePath: "/us/en/adventures/camping"
666+
pageId: "123e4567-e89b-12d3-a456-426614174001"
667+
chain:
668+
- pageId: "123e4567-e89b-12d3-a456-426614174012"
669+
pagePath: "/content/site/us/adventures"
670+
metadata:
671+
sourceType: "liveCopyOf"
672+
- pageId: "123e4567-e89b-12d3-a456-426614174013"
673+
pagePath: "/content/site/global/adventures"
674+
metadata:
675+
sourceType: "langCopyOf"
676+
errors: {}
677+
678+
page-relationships-search-no-relationship-response:
679+
description: Relationship lookup response where no source relationship is detected for a page
680+
value:
681+
supported: true
682+
relationships:
683+
"row-1":
684+
pagePath: "/de/de/adventures"
685+
pageId: "123e4567-e89b-12d3-a456-426614174000"
686+
chain: []
687+
errors: {}
688+
689+
page-relationships-search-partial-response:
690+
description: Relationship lookup response with partial per-page failures
691+
value:
692+
supported: true
693+
relationships:
694+
"row-2":
695+
pagePath: "/us/en/adventures/camping"
696+
pageId: "123e4567-e89b-12d3-a456-426614174002"
697+
chain:
698+
- pageId: "123e4567-e89b-12d3-a456-426614174020"
699+
pagePath: "/content/site/language-masters/de/adventures"
700+
metadata:
701+
sourceType: "langCopyOf"
702+
- pageId: "123e4567-e89b-12d3-a456-426614174021"
703+
pagePath: "/content/site/language-masters/en/adventures"
704+
metadata:
705+
sourceType: "langCopyOf"
706+
errors:
707+
"row-1":
708+
error: "Could not determine page ID"
709+
710+
page-relationships-search-unsupported-response:
711+
description: Response when page relationships are not supported for a site
712+
value:
713+
supported: false
714+
relationships: {}
715+
errors: {}

docs/openapi/schemas.yaml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6129,3 +6129,125 @@ SentimentConfig:
61296129
items:
61306130
$ref: '#/SentimentGuideline'
61316131
description: Guidelines (optionally filtered by audit type)
6132+
6133+
PageRelationshipsSearchPage:
6134+
type: object
6135+
required:
6136+
- pageUrl
6137+
- key
6138+
properties:
6139+
pageUrl:
6140+
type: string
6141+
description: Page path or absolute URL to resolve.
6142+
example: '/us/en/products'
6143+
suggestionType:
6144+
type: string
6145+
description: Suggestion/issue classifier used by the backend to apply relationship checks.
6146+
example: 'Missing Title'
6147+
key:
6148+
type: string
6149+
description: Caller-provided key used in relationships/errors maps.
6150+
example: 'row-1'
6151+
6152+
PageRelationshipChainItem:
6153+
type: object
6154+
description: |
6155+
A single step in the relationship lineage.
6156+
Chain items are ordered from the requested page's immediate parent upward through ancestors.
6157+
required:
6158+
- pageId
6159+
- pagePath
6160+
properties:
6161+
pageId:
6162+
type: string
6163+
description: page identifier for this chain.
6164+
example: '123e4567-e89b-12d3-a456-426614174000'
6165+
pagePath:
6166+
type: string
6167+
description: Page path for this chain hop.
6168+
example: '/language-masters/en/adventures'
6169+
metadata:
6170+
$ref: '#/PageRelationshipMetadata'
6171+
6172+
PageRelationshipMetadata:
6173+
type: object
6174+
additionalProperties: true
6175+
properties:
6176+
sourceType:
6177+
oneOf:
6178+
- type: string
6179+
- type: "null"
6180+
description: |
6181+
Source classification for this chain entry from the relationship provider.
6182+
Value is provider-defined and intentionally not constrained.
6183+
6184+
PageRelationship:
6185+
type: object
6186+
required:
6187+
- pagePath
6188+
- pageId
6189+
- chain
6190+
properties:
6191+
pagePath:
6192+
type: string
6193+
description: Normalized page path or absolute URL for the requested page.
6194+
example: '/us/en/adventures'
6195+
pageId:
6196+
type: string
6197+
description: Resolved page identifier used by downstream fix operations.
6198+
example: 'pg-123'
6199+
chain:
6200+
type: array
6201+
description: |
6202+
Ordered relationship lineage returned by content API.
6203+
Sequence starts with the immediate parent of the requested page,
6204+
then grandparent, and so on.
6205+
items:
6206+
$ref: '#/PageRelationshipChainItem'
6207+
6208+
PageRelationshipError:
6209+
type: object
6210+
required:
6211+
- error
6212+
properties:
6213+
error:
6214+
type: string
6215+
example: 'Could not determine page ID'
6216+
detail:
6217+
type: string
6218+
example: 'HTTP 404'
6219+
6220+
PageRelationshipsMapping:
6221+
type: object
6222+
additionalProperties:
6223+
$ref: '#/PageRelationship'
6224+
6225+
PageRelationshipsErrorMapping:
6226+
type: object
6227+
additionalProperties:
6228+
$ref: '#/PageRelationshipError'
6229+
6230+
PageRelationshipsSearchRequest:
6231+
type: object
6232+
required:
6233+
- pages
6234+
properties:
6235+
pages:
6236+
type: array
6237+
items:
6238+
$ref: '#/PageRelationshipsSearchPage'
6239+
6240+
PageRelationshipsSearchResponse:
6241+
type: object
6242+
required:
6243+
- supported
6244+
- relationships
6245+
- errors
6246+
properties:
6247+
supported:
6248+
type: boolean
6249+
example: true
6250+
relationships:
6251+
$ref: '#/PageRelationshipsMapping'
6252+
errors:
6253+
$ref: '#/PageRelationshipsErrorMapping'

docs/openapi/site-api.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,58 @@ site-cdn-logs-config:
150150
'500':
151151
$ref: './responses.yaml#/500'
152152

153+
site-page-relationships-search:
154+
parameters:
155+
- $ref: './parameters.yaml#/siteId'
156+
post:
157+
tags:
158+
- site
159+
summary: Search page relationships for caller-provided pages
160+
description: |
161+
Resolves page relationship context for the provided set of page paths/URLs.
162+
This endpoint is intended for on-demand UI flows (for example, fix-confirmation popups),
163+
where only specific pages need relationship context at request time.
164+
The returned `relationships[*].chain` is ordered from the immediate parent
165+
of the requested page to grandparent, and so on toward the root.
166+
operationId: searchSitePageRelationships
167+
security:
168+
- ims_key: [ ]
169+
requestBody:
170+
required: true
171+
content:
172+
application/json:
173+
schema:
174+
$ref: './schemas.yaml#/PageRelationshipsSearchRequest'
175+
examples:
176+
page-relationships-search-request:
177+
$ref: './examples.yaml#/page-relationships-search-request'
178+
responses:
179+
'200':
180+
description: Relationship lookup completed
181+
content:
182+
application/json:
183+
schema:
184+
$ref: './schemas.yaml#/PageRelationshipsSearchResponse'
185+
examples:
186+
page-relationships-search-response:
187+
$ref: './examples.yaml#/page-relationships-search-response'
188+
page-relationships-search-no-relationship-response:
189+
$ref: './examples.yaml#/page-relationships-search-no-relationship-response'
190+
page-relationships-search-partial-response:
191+
$ref: './examples.yaml#/page-relationships-search-partial-response'
192+
page-relationships-search-unsupported-response:
193+
$ref: './examples.yaml#/page-relationships-search-unsupported-response'
194+
'400':
195+
$ref: './responses.yaml#/400'
196+
'401':
197+
$ref: './responses.yaml#/401'
198+
'403':
199+
$ref: './responses.yaml#/403-site-access-forbidden'
200+
'404':
201+
$ref: './responses.yaml#/404-site-not-found-with-id'
202+
'500':
203+
$ref: './responses.yaml#/500'
204+
153205
site-reports:
154206
parameters:
155207
- $ref: './parameters.yaml#/siteId'

0 commit comments

Comments
 (0)