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

54 lines
1.5 KiB
Plaintext

import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
describe('no-invalid-parameter-examples', () => {
it('should report on invalid falsy example', async () => {
const document = parseYamlToDocument(
outdent`
openapi: 3.1.0
paths:
/results:
get:
parameters:
- name: username
in: query
schema:
type: string
maxLength: 15
example: false
`,
'foobar.yaml'
);
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: { 'no-invalid-parameter-examples': 'error' } }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"from": {
"pointer": "#/paths/~1results/get/parameters/0",
"source": "foobar.yaml",
},
"location": [
{
"pointer": "#/paths/~1results/get/parameters/0/example",
"reportOnKey": false,
"source": "foobar.yaml",
},
],
"message": "Example value must conform to the schema: type must be string.",
"ruleId": "no-invalid-parameter-examples",
"severity": "error",
"suggest": [],
},
]
`);
});
});