UNPKG

@asyncapi/react-component

Version:

A React component for AsyncAPI specification.

33 lines 1.27 kB
import React from 'react'; import { SchemaHelpers } from '../../helpers'; import { Schema } from './Schema'; export var AdditionalItems = function (_a) { var _b; var schema = _a.schema; if (!schema) { return null; } if (((_b = schema.extensions().get(SchemaHelpers.extRenderAdditionalInfo)) === null || _b === void 0 ? void 0 : _b.value()) === false) { return null; } var type = schema.type(); if (!(type === null || type === void 0 ? void 0 : type.includes('array'))) { return null; } if (!Array.isArray(schema.items())) { return null; } var additionalItems = schema.additionalItems(); if (additionalItems === true || additionalItems === undefined) { return (React.createElement("p", { className: "mt-2 text-xs text-gray-700" }, "Additional items are allowed.")); } if (additionalItems === false) { return (React.createElement("p", { className: "mt-2 text-xs text-gray-700" }, "Additional items are ", React.createElement("strong", null, "NOT"), " allowed.")); } return React.createElement(Schema, { schemaName: "Additional items:", schema: additionalItems }); }; //# sourceMappingURL=AdditionalItems.js.map