persona-community-5/.pnpm-store/v3/files/27/706296be66c7d25f882200f6d7ce28687e5c3bc7c8cf322f377ba97af95306955f6ab22837904a5b21a76a779a69fa91ed06d35e75da988bc5a3b0e7ef6695
rdev-worker a1d0d1bf1c
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
build: /implement-feature community-ui --requirements 'Build the React commu...
2026-02-24 08:22:30 +00:00

40 lines
1.6 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResponseContainsProperty = void 0;
const utils_1 = require("../../utils");
const ResponseContainsProperty = (options) => {
const names = options.names || {};
let key;
return {
Operation: {
Response: {
skip: (_response, key) => {
return `${key}` === '204';
},
enter: (_response, ctx) => {
key = ctx.key;
},
MediaType: {
Schema(schema, { report, location }) {
if (schema.type !== 'object')
return;
const expectedProperties = names[key] ||
names[(0, utils_1.getMatchingStatusCodeRange)(key)] ||
names[(0, utils_1.getMatchingStatusCodeRange)(key).toLowerCase()] ||
[];
for (const expectedProperty of expectedProperties) {
if (!schema.properties?.[expectedProperty]) {
report({
message: `Response object must contain a top-level "${expectedProperty}" property.`,
location: location.child('properties').key(),
});
}
}
},
},
},
},
};
};
exports.ResponseContainsProperty = ResponseContainsProperty;