Select variables in server url

This commit is contained in:
Brett Jephson
2024-08-27 19:03:20 +01:00
parent 042b850b5d
commit e793a177f6
@@ -12,5 +12,25 @@ export function OpenAPIServerURLVariable(props: {
variable: OpenAPIV3.ServerVariableObject;
}) {
const { variable } = props;
if (variable.enum && variable.enum.length > 0) {
return (<select
className={classNames(
'openapi-section-select',
'openapi-select',
)}
value={variable.default}
>
{
variable.enum?.map((value: string) => {
return (
<option key={value} value={value}>
{value}
</option>
);
}) ?? null}
</select>);
}
return <span className={classNames('openapi-url-var')}>{variable.default}</span>;
}