problemTypeUri function
String
problemTypeUri({
- required ErrorPortal portal,
- required ProblemTypeSegment version,
- required ProblemTypeSegment id,
Builds the RFC 9457 type URI from an ErrorPortal config block.
This is the single source of the type-URI template (C0 §2). Every problem —
catalog entries, runtime envelopes, local errors — resolves its type
through this function.
id is the WIRE id and must be snake_case per R-E14
(problemWireIdPattern); version must be v<n>.
final uri = problemTypeUri(
portal: portal,
version: 'v1',
id: 'entity_not_found',
);
// https://docs.raichu.cluster.atomi.cloud/docs/raichu/dotnet/user/v1/entity_not_found
Implementation
String problemTypeUri({
required ErrorPortal portal,
required ProblemTypeSegment version,
required ProblemTypeSegment id,
}) {
_check('scheme', portal.scheme);
_checkHost(portal.scheme, portal.host);
_check('landscape', portal.landscape);
_check('platform', portal.platform);
_check('service', portal.service);
_check('module', portal.module);
_check('version', version, problemVersionPattern);
_check('id', id, problemWireIdPattern);
return '${portal.scheme}://${portal.host}/docs/${portal.landscape}'
'/${portal.platform}/${portal.service}/${portal.module}/$version/$id';
}