persona-community-5/.pnpm-store/v3/files/16/e64d6ddf49f8c4f94265443c1036b04f17a0995e0ac6ed707080c18672d1ca86772badfaec69d6d25a94d098132a20f4e3ca90ecec0eba880259879a57f668
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

27 lines
804 B
Plaintext

import { readFileAsStringSync } from '../../utils';
import type { Oas3Decorator, Oas2Decorator } from '../../visitors';
import type { UserContext } from '../../walk';
export const TagDescriptionOverride: Oas3Decorator | Oas2Decorator = ({ tagNames }) => {
return {
Tag: {
leave(tag, { report }: UserContext) {
if (!tagNames)
throw new Error(
`Parameter "tagNames" is not provided for "tag-description-override" rule`
);
if (tagNames[tag.name]) {
try {
tag.description = readFileAsStringSync(tagNames[tag.name]);
} catch (e) {
report({
message: `Failed to read markdown override file for tag "${tag.name}".\n${e.message}`,
});
}
}
},
},
};
};