persona-community-5/.pnpm-store/v3/files/9c/d5f4d52997ef0263a1b75ef8dcc497f68e6ed3746c7d251a6a52e5d50965692a39745330963606421b8ae452842c599e62298eb1fc81f973d6a718eea9a717
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

45 lines
1.3 KiB
Plaintext

import type { UserContext } from '../../walk';
import type { Oas3Schema, Oas3_1Schema } from '../../typings/openapi';
import type { Oas2Schema } from 'core/src/typings/swagger';
import type { Oas3Rule } from 'core/src/visitors';
export const RequiredStringPropertyMissingMinLength: Oas3Rule = () => {
let skipSchemaProperties: boolean;
let requiredPropertiesSet: Set<string>;
return {
Schema: {
enter(schema: Oas3Schema | Oas3_1Schema | Oas2Schema) {
if (!schema?.required) {
skipSchemaProperties = true;
return;
}
requiredPropertiesSet = new Set(schema.required);
skipSchemaProperties = false;
},
SchemaProperties: {
skip() {
return skipSchemaProperties;
},
Schema: {
enter(
schema: Oas3Schema | Oas3_1Schema | Oas2Schema,
{ key, location, report }: UserContext
) {
if (requiredPropertiesSet.has(key as string) && schema.type === 'string') {
if (!schema?.minLength) {
report({
message: 'Property minLength is required.',
location: location.key(),
});
}
}
},
},
},
},
};
};