@nestia/sdk
Version:
Nestia SDK and Swagger generator
20 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TextPlainValidator = void 0;
const legacy_1 = require("../internal/legacy");
var TextPlainValidator;
(function (TextPlainValidator) {
TextPlainValidator.validate = (props) => {
const expected = props.metadata.atomics.filter((a) => a.type === "string").length +
props.metadata.constants
.filter((c) => c.type === "string")
.map((c) => c.values.length)
.reduce((a, b) => a + b, 0) +
props.metadata.templates.length +
props.metadata.natives.filter((n) => n.name === "String").length;
if ((0, legacy_1.sizeOf)(props.metadata) === 0 || (0, legacy_1.sizeOf)(props.metadata) !== expected)
return [`Only string type is allowed in the "text/plain" content type.`];
return [];
};
})(TextPlainValidator || (exports.TextPlainValidator = TextPlainValidator = {}));
//# sourceMappingURL=TextPlainValidator.js.map