ParameterTable
Domain · API DocTable displaying API parameters with location (path/query/header/cookie), type, required flag, and description.
| Name | Type | Required | Description |
|---|---|---|---|
| page | integer | Page number (1-based) | |
| pageSize* | integer | required | Items per page |
<%- include('modules/domain/api-doc/ParameterTable', {
parameters: [
{ parameterId: 'p1', name: 'page', in: 'query', schema: { type: 'integer' }, description: 'Page number (1-based)' },
{ parameterId: 'p2', name: 'pageSize', in: 'query', required: true, schema: { type: 'integer' }, description: 'Items per page' },
]
}) %>
<%
var _parameters = locals.parameters || [];
if (!_parameters.length) { return; }
var locationVariant = {
path: 'primary',
query: 'info',
header: 'warning',
cookie: 'neutral',
};
%>
Name
In
Type
Required
Description
<% _parameters.forEach(function(param) {
var schema = param.schema || {};
var typeStr = schema.type || (schema.$ref ? '$ref' : '—');
var inVar = locationVariant[param.in] || 'neutral';
%>
<%= param.name %>
<% if (param.deprecated) { %>
<%- include('../../ui/Badge', { variant: 'warning', size: 'sm', children: 'deprecated' }) %>
<% } %>
<%- include('../../ui/Badge', { variant: inVar, size: 'sm', children: param.in }) %>
<%= typeStr %><% if (schema.format) { %> (<%= schema.format %>)<% } %>
<% if (param.required) { %>
<%- include('../../ui/Badge', { variant: 'error', size: 'sm', children: 'required' }) %>
<% } else { %>
optional
<% } %>
<%= param.description || '—' %>
<% if (schema.example !== undefined) { %>
<%- include('../../ui/Tooltip', {
content: 'e.g. ' + String(schema.example) + '',
placement: 'top',
children: ''
}) %>
<% } %>
<% if (schema.enum && schema.enum.length) { %>
<% schema.enum.forEach(function(v) { %>
<%= String(v) %>
<% }); %>
<% } %>
<% }); %>