@asyncapi/react-component
Version:
A React component for AsyncAPI specification.
30 lines • 1.26 kB
JavaScript
import React from 'react';
import { SchemaHelpers } from '../../helpers';
import { Schema } from './Schema';
export var AdditionalProperties = 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('object'))) {
return null;
}
var additionalProperties = schema.additionalProperties();
if (additionalProperties === true || additionalProperties === undefined) {
return (React.createElement("p", { className: "mt-2 text-xs text-gray-700" }, "Additional properties are allowed."));
}
if (additionalProperties === false) {
return (React.createElement("p", { className: "mt-2 text-xs text-gray-700" },
"Additional properties are ",
React.createElement("strong", null, "NOT"),
" allowed."));
}
return (React.createElement(Schema, { schemaName: "Additional properties:", schema: additionalProperties }));
};
//# sourceMappingURL=AdditionalProperties.js.map