Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion api-gateway/src/api/service/policy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Auth, AuthUser } from '#auth';
import { CACHE, POLICY_REQUIRED_PROPS, PREFIXES } from '#constants';
import { AnyFilesInterceptor, CacheService, EntityOwner, getCacheKey, InternalException, ONLY_SR, PolicyEngine, ProjectService, ServiceError, TaskManager, UploadedFiles, UseCache, parseSavepointIdsJson, FilenameSanitizer } from '#helpers';
import { IAuthUser, MockType, PinoLogger, RunFunctionAsync } from '@guardian/common';
import { findBlocks, IAuthUser, MockType, PinoLogger, RunFunctionAsync } from '@guardian/common';
import { DocumentType, MigrationRunStatus, Permissions, PolicyHelper, PolicyStatus, TaskAction, UserRole } from '@guardian/interfaces';
import {
Body,
Expand Down Expand Up @@ -1486,10 +1486,18 @@ export class PolicyApi {
{ name: 'filterByUUID', type: 'string', description: 'Filter by document UUID' },
],
};
const schemaByTag = new Map<string, string>(
entries.length
? findBlocks(policy.config, (node: any) => !!(node.tag && node.options?.schema))
.map((block: any) => [block.tag, block.options.schema])
: []
);
return entries.map((entry: any) => {
const getParams = getParamsByBlockType[entry.blockType] || [];
const schemaId = schemaByTag.get(entry.target);
return {
...entry,
...(schemaId ? { schemaId } : {}),
getQueryParams: entry.method !== 'POST' ? getParams : [],
postQueryParams: entry.method !== 'GET' ? postParams : [],
};
Expand Down
14 changes: 14 additions & 0 deletions docs/guardian/policy-api-documentation-and-dmrv-aliases.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ Authorization: Bearer <token>

Returns the configured documentation entries.

When the target block references a schema (e.g. `requestVcDocumentBlock`, `documentValidatorBlock`), the entry includes a `schemaId` field with the schema's IRI. The field is omitted for blocks that don't reference a schema.

**Response example:**

```json
Expand All @@ -156,6 +158,18 @@ Returns the configured documentation entries.
{ "name": "filterByUUID", "type": "string", "description": "Filter by document UUID" },
{ "name": "savepointIds", "type": "string[]", "description": "Savepoint IDs filter (JSON array)" }
]
},
{
"name": "Create Application",
"description": "Submit a new applicant registration",
"target": "create_application",
"method": "POST",
"alias": "create-application",
"url": "/api/v1/policies/69c3dbe9a4d2ac84f75cdfc4/tag/create_application/blocks",
"dmrvUrl": "/api/v1/dmrv/69c3dbe9a4d2ac84f75cdfc4/create-application",
"blockType": "requestVcDocumentBlock",
"schemaId": "#9bd1c75b-76df-4d3c-8775-1f76d18d7d8c",
"queryParams": []
}
]
```
4 changes: 4 additions & 0 deletions interfaces/src/interface/policy.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export interface IPolicyDocumentationEntry {
* Block type (auto-populated for query params display)
*/
blockType?: string;
/**
* Schema IRI bound to the target block (auto-populated by /about)
*/
schemaId?: string;
}

/**
Expand Down
Loading