chore: remap arazzo schema to our internal type (#1656)

This commit is contained in:
Dmytro Anansky
2024-08-16 15:50:05 +03:00
committed by GitHub
parent d6580ea9b6
commit 7b0ff3ad77
81 changed files with 1389 additions and 860 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -13,10 +13,10 @@ module.exports = {
newTypes = { newTypes = {
...types, ...types,
XMetaData: XMetaData, XMetaData: XMetaData,
'Root.info': { Info: {
...types['Root.info'], ...types['Info'],
properties: { properties: {
...types['Root.info'].properties, ...types['Info'].properties,
metadata: 'XMetaData', metadata: 'XMetaData',
}, },
}, },

View File

@@ -4,7 +4,7 @@ exports[`E2E stats stats should produce correct JSON output 1`] = `
{ {
"refs": { "refs": {
"metric": "🚗 References", "metric": "🚗 References",
"total": 39 "total": 43
}, },
"externalDocs": { "externalDocs": {
"metric": "📦 External Documents", "metric": "📦 External Documents",
@@ -12,7 +12,7 @@ exports[`E2E stats stats should produce correct JSON output 1`] = `
}, },
"schemas": { "schemas": {
"metric": "📈 Schemas", "metric": "📈 Schemas",
"total": 22 "total": 23
}, },
"parameters": { "parameters": {
"metric": "👉 Parameters", "metric": "👉 Parameters",

View File

@@ -3,9 +3,9 @@
exports[`E2E stats stats should produce correct Markdown format 1`] = ` exports[`E2E stats stats should produce correct Markdown format 1`] = `
| Feature | Count | | Feature | Count |
| --- | --- | | --- | --- |
| 🚗 References | 39 | | 🚗 References | 43 |
| 📦 External Documents | 0 | | 📦 External Documents | 0 |
| 📈 Schemas | 22 | | 📈 Schemas | 23 |
| 👉 Parameters | 6 | | 👉 Parameters | 6 |
| 🔗 Links | 0 | | 🔗 Links | 0 |
| 🔀 Path Items | 5 | | 🔀 Path Items | 5 |

View File

@@ -4,9 +4,9 @@ exports[`E2E stats stats should produce correct output (stylish format) 1`] = `
Document: museum.yaml stats: Document: museum.yaml stats:
🚗 References: 39 🚗 References: 43
📦 External Documents: 0 📦 External Documents: 0
📈 Schemas: 22 📈 Schemas: 23
👉 Parameters: 6 👉 Parameters: 6
🔗 Links: 0 🔗 Links: 0
🔀 Path Items: 5 🔀 Path Items: 5

View File

@@ -1,3 +1,9 @@
---
seo:
title: Lint Arazzo with Redocly CLI
description: Unlock powerful linting capabilities for Arazzo documents. Use the Redocly CLI to enforce basic validation, configure rules, or even build custom plugins for Arazzo.
---
# Lint Arazzo with Redocly CLI # Lint Arazzo with Redocly CLI
[Arazzo](https://spec.openapis.org/arazzo/latest.html#arazzo-specification) is an open standard from the OpenAPI Initiative for describing a sequence API calls, defining success criteria, and adding response content to subsequent API calls. [Arazzo](https://spec.openapis.org/arazzo/latest.html#arazzo-specification) is an open standard from the OpenAPI Initiative for describing a sequence API calls, defining success criteria, and adding response content to subsequent API calls.
@@ -108,6 +114,13 @@ With this action in place, the intentional errors I added to the Arazzo descript
![Screenshot of annotation flagging "workfloo" as an unexpected value and suggesting "workflow"](images/museum-arazzo-lint.png) ![Screenshot of annotation flagging "workfloo" as an unexpected value and suggesting "workflow"](images/museum-arazzo-lint.png)
## Arazzo rules
To expand the linting checks for an Arazzo description, start by enabling
some of the built-in rules. The currently-supported rules are:
- `parameters-no-body-inside-in`: the `in` section inside `parameters` must not contain a `body`.
## Participate in Redocly CLI ## Participate in Redocly CLI
Redocly CLI is an open source project, so we invite you to check out the [code on GitHub](https://github.com/Redocly/redocly-cli/), and open issues to report problems or request features. Redocly CLI is an open source project, so we invite you to check out the [code on GitHub](https://github.com/Redocly/redocly-cli/), and open issues to report problems or request features.

View File

@@ -13,7 +13,7 @@ module.exports = {
coverageThreshold: { coverageThreshold: {
'packages/core/': { 'packages/core/': {
statements: 80, statements: 80,
branches: 72, branches: 71,
functions: 74, functions: 74,
lines: 80, lines: 80,
}, },

View File

@@ -69,17 +69,24 @@ export function makeConfigForRuleset(
}); });
} }
export async function makeConfig( export async function makeConfig({
rules: Record<string, RuleConfig>, rules,
decorators?: Record<string, DecoratorConfig>, decorators,
configPath?: string configPath,
) { arazzoRules,
}: {
rules: Record<string, RuleConfig>;
decorators?: Record<string, DecoratorConfig>;
configPath?: string;
arazzoRules?: Record<string, RuleConfig>;
}) {
return new StyleguideConfig( return new StyleguideConfig(
await resolveStyleguideConfig({ await resolveStyleguideConfig({
styleguideConfig: { styleguideConfig: {
plugins: [], plugins: [],
extends: [], extends: [],
rules, rules,
arazzoRules,
decorators, decorators,
}, },
}), }),

View File

@@ -164,7 +164,7 @@ describe('bundle', () => {
'' ''
); );
const config = await makeConfig({}, { 'registry-dependencies': 'on' }); const config = await makeConfig({ rules: {}, decorators: { 'registry-dependencies': 'on' } });
const { const {
bundle: result, bundle: result,
@@ -205,7 +205,7 @@ describe('bundle', () => {
'' ''
); );
const config = await makeConfig({}); const config = await makeConfig({ rules: {} });
const { const {
bundle: { parsed }, bundle: { parsed },
@@ -305,7 +305,7 @@ describe('bundle async', () => {
'' ''
); );
const config = await makeConfig({}); const config = await makeConfig({ rules: {} });
const { const {
bundle: { parsed }, bundle: { parsed },
@@ -375,7 +375,7 @@ describe('bundle async', () => {
'' ''
); );
const config = await makeConfig({}); const config = await makeConfig({ rules: {} });
const { const {
bundle: { parsed }, bundle: { parsed },

View File

@@ -1413,7 +1413,7 @@ describe('lint', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -1492,7 +1492,7 @@ describe('lint', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -1528,7 +1528,11 @@ describe('lint', () => {
const result = await lintDocument({ const result = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-operationId': 'error' }, undefined, configFilePath), config: await makeConfig({
rules: { 'operation-operationId': 'error' },
decorators: undefined,
configPath: configFilePath,
}),
}); });
expect(result).toHaveLength(1); expect(result).toHaveLength(1);
expect(result).toMatchObject([ expect(result).toMatchObject([
@@ -1590,7 +1594,11 @@ describe('lint', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }, undefined, configFilePath), config: await makeConfig({
rules: { spec: 'error' },
decorators: undefined,
configPath: configFilePath,
}),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -1662,7 +1670,11 @@ describe('lint', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }, undefined, configFilePath), config: await makeConfig({
rules: { spec: 'error' },
decorators: undefined,
configPath: configFilePath,
}),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -5,6 +5,7 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
"arazzoDecorators": {}, "arazzoDecorators": {},
"arazzoPreprocessors": {}, "arazzoPreprocessors": {},
"arazzoRules": { "arazzoRules": {
"parameters-no-body-inside-in": "off",
"spec": "error", "spec": "error",
}, },
"async2Decorators": {}, "async2Decorators": {},
@@ -133,6 +134,7 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
"arazzoDecorators": {}, "arazzoDecorators": {},
"arazzoPreprocessors": {}, "arazzoPreprocessors": {},
"arazzoRules": { "arazzoRules": {
"parameters-no-body-inside-in": "off",
"spec": "error", "spec": "error",
}, },
"async2Decorators": {}, "async2Decorators": {},

View File

@@ -123,7 +123,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
'channels-kebab-case': 'error', 'channels-kebab-case': 'error',
'no-channel-trailing-slash': 'error', 'no-channel-trailing-slash': 'error',
}, },
arazzoRules: { spec: 'error' }, arazzoRules: { spec: 'error', 'parameters-no-body-inside-in': 'off' },
}; };
export default all; export default all;

View File

@@ -107,6 +107,7 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
}, },
arazzoRules: { arazzoRules: {
spec: 'error', spec: 'error',
'parameters-no-body-inside-in': 'off',
}, },
}; };

View File

@@ -107,6 +107,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
}, },
arazzoRules: { arazzoRules: {
spec: 'error', spec: 'error',
'parameters-no-body-inside-in': 'off',
}, },
}; };

View File

@@ -107,6 +107,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
}, },
arazzoRules: { arazzoRules: {
spec: 'error', spec: 'error',
'parameters-no-body-inside-in': 'off',
}, },
}; };

View File

@@ -56,7 +56,10 @@ describe('oas3 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'filter-in': { value: 'public', property: 'x-access' } }), config: await makeConfig({
rules: {},
decorators: { 'filter-in': { value: 'public', property: 'x-access' } },
}),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -76,16 +79,16 @@ describe('oas3 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: inputDoc, document: inputDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-in': { 'filter-in': {
property: 'x-audience', property: 'x-audience',
value: ['Public', 'Protected'], value: ['Public', 'Protected'],
matchStrategy: 'all', matchStrategy: 'all',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -130,16 +133,16 @@ describe('oas3 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-in': { 'filter-in': {
property: 'x-audience', property: 'x-audience',
value: ['Public', 'Global'], value: ['Public', 'Global'],
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -171,16 +174,16 @@ describe('oas3 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: inputDoc, document: inputDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-in': { 'filter-in': {
property: 'x-audience', property: 'x-audience',
value: 'non-existing-audience', value: 'non-existing-audience',
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -220,16 +223,16 @@ describe('oas3 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-in': { 'filter-in': {
property: 'x-audience', property: 'x-audience',
value: ['Public', 'Global'], value: ['Public', 'Global'],
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -279,16 +282,16 @@ describe('oas2 filter-in', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-in': { 'filter-in': {
property: 'x-access', property: 'x-access',
value: ['public', 'global'], value: ['public', 'global'],
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
swagger: '2.0' swagger: '2.0'

View File

@@ -52,7 +52,10 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'filter-out': { property: 'x-access', value: 'private' } }), config: await makeConfig({
rules: {},
decorators: { 'filter-out': { property: 'x-access', value: 'private' } },
}),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -68,16 +71,16 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: inputDoc, document: inputDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-out': { 'filter-out': {
property: 'x-audience', property: 'x-audience',
value: ['Private', 'Protected'], value: ['Private', 'Protected'],
matchStrategy: 'all', matchStrategy: 'all',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -99,16 +102,16 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: inputDoc, document: inputDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-out': { 'filter-out': {
property: 'x-audience', property: 'x-audience',
value: ['Private', 'Protected'], value: ['Private', 'Protected'],
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -138,16 +141,16 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-out': { 'filter-out': {
property: 'x-access', property: 'x-access',
value: 'private', value: 'private',
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -192,7 +195,10 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'filter-out': { property: 'x-prop', value: false } }), config: await makeConfig({
rules: {},
decorators: { 'filter-out': { property: 'x-prop', value: false } },
}),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -244,7 +250,10 @@ describe('oas3 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'filter-out': { property: 'x-prop', value: null } }), config: await makeConfig({
rules: {},
decorators: { 'filter-out': { property: 'x-prop', value: null } },
}),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -305,16 +314,16 @@ describe('oas2 filter-out', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'filter-out': { 'filter-out': {
property: 'x-access', property: 'x-access',
value: ['private', 'protected'], value: ['private', 'protected'],
matchStrategy: 'any', matchStrategy: 'any',
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
swagger: '2.0' swagger: '2.0'

View File

@@ -28,9 +28,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -43,8 +43,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -88,9 +88,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -101,8 +101,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -153,9 +153,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -176,8 +176,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -245,9 +245,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -264,8 +264,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -345,9 +345,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -364,8 +364,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -417,9 +417,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -436,8 +436,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -489,9 +489,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -504,8 +504,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -550,9 +550,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -565,8 +565,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -618,9 +618,9 @@ describe('oas3 media-type-examples-override', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig( config: await makeConfig({
{}, rules: {},
{ decorators: {
'media-type-examples-override': { 'media-type-examples-override': {
operationIds: { operationIds: {
getUserById: { getUserById: {
@@ -633,8 +633,8 @@ describe('oas3 media-type-examples-override', () => {
}, },
}, },
}, },
} },
), }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`

View File

@@ -25,7 +25,10 @@ describe('oas3 remove-x-internal', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDocument, document: testDocument,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'remove-x-internal': { internalFlagProperty: 'removeit' } }), config: await makeConfig({
rules: {},
decorators: { 'remove-x-internal': { internalFlagProperty: 'removeit' } },
}),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.0 openapi: 3.0.0
@@ -92,7 +95,7 @@ describe('oas3 remove-x-internal', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'remove-x-internal': 'on' }), config: await makeConfig({ rules: {}, decorators: { 'remove-x-internal': 'on' } }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.1.0 openapi: 3.1.0
@@ -165,7 +168,7 @@ describe('oas3 remove-x-internal', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'remove-x-internal': 'on' }), config: await makeConfig({ rules: {}, decorators: { 'remove-x-internal': 'on' } }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
@@ -239,7 +242,7 @@ describe('oas3 remove-x-internal', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'remove-x-internal': 'on' }), config: await makeConfig({ rules: {}, decorators: { 'remove-x-internal': 'on' } }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
openapi: 3.0.1 openapi: 3.0.1
@@ -302,7 +305,7 @@ describe('oas2 remove-x-internal', () => {
const { bundle: res } = await bundleDocument({ const { bundle: res } = await bundleDocument({
document: testDoc, document: testDoc,
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
config: await makeConfig({}, { 'remove-x-internal': 'on' }), config: await makeConfig({ rules: {}, decorators: { 'remove-x-internal': 'on' } }),
}); });
expect(res.parsed).toMatchInlineSnapshot(` expect(res.parsed).toMatchInlineSnapshot(`
swagger: '2.0' swagger: '2.0'

View File

@@ -38,7 +38,7 @@ describe('oas2 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });
@@ -111,7 +111,7 @@ describe('oas2 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });
@@ -192,7 +192,7 @@ describe('oas2 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });

View File

@@ -42,7 +42,7 @@ describe('oas3 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });
@@ -121,7 +121,7 @@ describe('oas3 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });
@@ -204,7 +204,7 @@ describe('oas3 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });
@@ -270,7 +270,7 @@ describe('oas3 remove-unused-components', () => {
const results = await bundleDocument({ const results = await bundleDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({}), config: await makeConfig({ rules: {} }),
removeUnusedComponents: true, removeUnusedComponents: true,
}); });

View File

@@ -22,7 +22,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -62,7 +64,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -119,7 +123,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -143,7 +149,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -190,7 +198,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -219,7 +229,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });
@@ -248,7 +260,9 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-unresolved-refs': 'error', rules: {
'no-unresolved-refs': 'error',
},
}), }),
}); });

View File

@@ -0,0 +1,76 @@
import { outdent } from 'outdent';
import { lintDocument } from '../../../lint';
import { parseYamlToDocument, replaceSourceWithRef, makeConfig } from '../../../../__tests__/utils';
import { BaseResolver } from '../../../resolve';
import { StyleguideConfig } from '../../../config';
import { ArazzoRule } from '../../../visitors';
describe('Arazzo parameters-no-body-inside-in', () => {
const document = parseYamlToDocument(
outdent`
arazzo: '1.0.0'
info:
title: Cool API
version: 1.0.0
description: A cool API
sourceDescriptions:
- name: museum-api
type: openapi
url: openapi.yaml
workflows:
- workflowId: get-museum-hours
description: This workflow demonstrates how to get the museum opening hours and buy tickets.
parameters:
- in: body
name: Authorization
value: Basic Og==
steps:
- stepId: get-museum-hours
description: >-
Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description.
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
`,
'arazzo.yaml'
);
it('should not report on `body` inside parameter `in` field', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({ rules: {} }),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
});
it('should report on `body` inside parameter `in` field', async () => {
const results = await lintDocument({
externalRefResolver: new BaseResolver(),
document,
config: await makeConfig({
rules: {},
arazzoRules: { 'parameters-no-body-inside-in': 'error' },
}),
});
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[
{
"location": [
{
"pointer": "#/workflows/0/parameters/0/in",
"reportOnKey": false,
"source": "arazzo.yaml",
},
],
"message": "The \`body\` value of the \`in\` property is not supported by Spot.",
"ruleId": "parameters-no-body-inside-in",
"severity": "error",
"suggest": [],
},
]
`);
});
});

View File

@@ -1,5 +1,6 @@
import { Spec } from '../common/spec'; import { Spec } from '../common/spec';
import { Assertions } from '../common/assertions'; import { Assertions } from '../common/assertions';
import { ParametersNoBodyInsideIn } from '../spot/parameters-no-body-inside-in';
import type { ArazzoRule } from '../../visitors'; import type { ArazzoRule } from '../../visitors';
import type { ArazzoRuleSet } from '../../oas-types'; import type { ArazzoRuleSet } from '../../oas-types';
@@ -7,6 +8,7 @@ import type { ArazzoRuleSet } from '../../oas-types';
export const rules: ArazzoRuleSet<'built-in'> = { export const rules: ArazzoRuleSet<'built-in'> = {
spec: Spec as ArazzoRule, spec: Spec as ArazzoRule,
assertions: Assertions as ArazzoRule, assertions: Assertions as ArazzoRule,
'parameters-no-body-inside-in': ParametersNoBodyInsideIn as ArazzoRule,
}; };
export const preprocessors = {}; export const preprocessors = {};

View File

@@ -23,7 +23,7 @@ describe('Async2 channels-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'channels-kebab-case': 'error' }), config: await makeConfig({ rules: { 'channels-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -64,7 +64,7 @@ describe('Async2 channels-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'channels-kebab-case': 'error' }), config: await makeConfig({ rules: { 'channels-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -106,8 +106,10 @@ describe('Async2 channels-kebab-case', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'paths-kebab-case': 'error', rules: {
'no-path-trailing-slash': 'off', 'paths-kebab-case': 'error',
'no-path-trailing-slash': 'off',
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -133,7 +135,9 @@ describe('Async2 channels-kebab-case', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'paths-kebab-case': 'error', rules: {
'paths-kebab-case': 'error',
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -23,7 +23,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -64,7 +64,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -89,7 +89,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -23,7 +23,7 @@ describe('Async2 channels-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'channels-kebab-case': 'error' }), config: await makeConfig({ rules: { 'channels-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -64,7 +64,7 @@ describe('Async2 channels-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'channels-kebab-case': 'error' }), config: await makeConfig({ rules: { 'channels-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -106,8 +106,10 @@ describe('Async2 channels-kebab-case', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'paths-kebab-case': 'error', rules: {
'no-path-trailing-slash': 'off', 'paths-kebab-case': 'error',
'no-path-trailing-slash': 'off',
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -133,7 +135,9 @@ describe('Async2 channels-kebab-case', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'paths-kebab-case': 'error', rules: {
'paths-kebab-case': 'error',
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -23,7 +23,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[ [
@@ -63,7 +63,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -88,7 +88,7 @@ describe('no-channel-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-channel-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-channel-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -17,7 +17,7 @@ describe('Oas3 info-license', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'info-license': 'error' }), config: await makeConfig({ rules: { 'info-license': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -54,7 +54,7 @@ describe('Oas3 info-license', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'info-license': 'error' }), config: await makeConfig({ rules: { 'info-license': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -18,7 +18,7 @@ describe('Oas3 license-url', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'info-license-url': 'error' }), config: await makeConfig({ rules: { 'info-license-url': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -55,7 +55,7 @@ describe('Oas3 license-url', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'info-license-url': 'error' }), config: await makeConfig({ rules: { 'info-license': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -46,7 +46,7 @@ describe('no-ambiguous-paths', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-ambiguous-paths': 'error' }), config: await makeConfig({ rules: { 'no-ambiguous-paths': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -29,7 +29,7 @@ describe('Oas3 typed enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }), config: await makeConfig({ rules: { 'no-enum-type-mismatch': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -62,7 +62,7 @@ describe('Oas3 typed enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }), config: await makeConfig({ rules: { 'no-enum-type-mismatch': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -92,7 +92,7 @@ describe('Oas3 typed enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }), config: await makeConfig({ rules: { 'no-enum-type-mismatch': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -140,7 +140,7 @@ describe('Oas3 typed enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-enum-type-mismatch': 'error' }), config: await makeConfig({ rules: { 'no-enum-type-mismatch': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -185,7 +185,7 @@ describe('Oas3 typed enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error', 'no-enum-type-mismatch': 'error' }), config: await makeConfig({ rules: { spec: 'error', 'no-enum-type-mismatch': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -34,7 +34,7 @@ describe('no-identical-paths', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-identical-paths': 'error' }), config: await makeConfig({ rules: { 'no-identical-paths': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -25,7 +25,7 @@ describe('no-invalid-parameter-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-parameter-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-parameter-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -23,7 +23,7 @@ describe('no-invalid-schema-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-schema-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-schema-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -19,7 +19,7 @@ describe('no-path-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-path-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-path-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -60,7 +60,7 @@ describe('no-path-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-path-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-path-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -97,7 +97,7 @@ describe('no-path-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-path-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-path-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -118,7 +118,7 @@ describe('no-path-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-path-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-path-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -30,7 +30,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -79,7 +79,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -134,7 +134,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -190,7 +190,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -223,7 +223,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -286,7 +286,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -329,7 +329,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -378,7 +378,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -447,7 +447,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -486,7 +486,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -542,7 +542,7 @@ describe('no-required-schema-properties-undefined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-required-schema-properties-undefined': 'error' }), config: await makeConfig({ rules: { 'no-required-schema-properties-undefined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -21,7 +21,7 @@ describe('Oas3 operation-2xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -60,7 +60,7 @@ describe('Oas3 operation-2xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -83,7 +83,7 @@ describe('Oas3 operation-2xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -104,7 +104,7 @@ describe('Oas3 operation-2xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -144,7 +144,9 @@ describe('Oas3 operation-2xx-response', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'operation-2xx-response': { severity: 'error', validateWebhooks: true }, rules: {
'operation-2xx-response': { severity: 'error', validateWebhooks: true },
},
}), }),
}); });
@@ -184,7 +186,7 @@ describe('Oas3 operation-2xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -21,7 +21,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -60,7 +60,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -83,7 +83,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -106,7 +106,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -143,7 +143,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-2xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-2xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -183,7 +183,9 @@ describe('Oas3 operation-4xx-response', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'operation-4xx-response': { severity: 'error', validateWebhooks: true }, rules: {
'operation-4xx-response': { severity: 'error', validateWebhooks: true },
},
}), }),
}); });
@@ -223,7 +225,7 @@ describe('Oas3 operation-4xx-response', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-response': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-response': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -26,7 +26,7 @@ describe('Oas3 operation-operationId-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-operationId-unique': 'error' }), config: await makeConfig({ rules: { 'operation-operationId-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -68,7 +68,7 @@ describe('Oas3 operation-operationId-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'peration-operationId-unique': 'error' }), config: await makeConfig({ rules: { 'peration-operationId-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -21,7 +21,7 @@ describe('Oas3 operation-operationId-url-safe', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-operationId-url-safe': 'error' }), config: await makeConfig({ rules: { 'operation-operationId-url-safe': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -22,7 +22,7 @@ describe('Oas3 operation-parameters-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-parameters-unique': 'error' }), config: await makeConfig({ rules: { 'operation-parameters-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -65,7 +65,7 @@ describe('Oas3 operation-parameters-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-parameters-unique': 'error' }), config: await makeConfig({ rules: { 'operation-parameters-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -95,7 +95,7 @@ describe('Oas3 operation-parameters-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-parameters-unique': 'error' }), config: await makeConfig({ rules: { 'operation-parameters-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -143,7 +143,7 @@ describe('Oas3 operation-parameters-unique', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-parameters-unique': 'error' }), config: await makeConfig({ rules: { 'operation-parameters-unique': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -24,7 +24,7 @@ describe('Oas3 operation-singular-tag', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-singular-tag': 'error' }), config: await makeConfig({ rules: { 'operation-singular-tag': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -64,7 +64,7 @@ describe('Oas3 operation-singular-tag', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-singular-tag': 'error' }), config: await makeConfig({ rules: { 'operation-singular-tag': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -23,7 +23,7 @@ describe('Common path-http-verbs-order', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-http-verbs-order': 'error' }), config: await makeConfig({ rules: { 'path-http-verbs-order': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -87,7 +87,7 @@ describe('Common path-http-verbs-order', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-http-verbs-order': 'error' }), config: await makeConfig({ rules: { 'path-http-verbs-order': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -19,7 +19,7 @@ describe('Oas3 path-not-include-query', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-not-include-query': 'error' }), config: await makeConfig({ rules: { 'path-not-include-query': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -56,7 +56,7 @@ describe('Oas3 path-not-include-query', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-not-include-query': 'error' }), config: await makeConfig({ rules: { 'path-not-include-query': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -24,7 +24,7 @@ describe('Oas3 path-params-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-params-defined': 'error' }), config: await makeConfig({ rules: { 'path-params-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -52,7 +52,7 @@ describe('Oas3 path-params-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-params-defined': 'error' }), config: await makeConfig({ rules: { 'path-params-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -96,7 +96,7 @@ describe('Oas3 path-params-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-params-defined': 'error' }), config: await makeConfig({ rules: { 'path-params-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -150,7 +150,7 @@ describe('Oas3 path-params-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-params-defined': 'error' }), config: await makeConfig({ rules: { 'path-params-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -194,7 +194,7 @@ describe('Oas3 path-params-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'path-params-defined': 'error' }), config: await makeConfig({ rules: { 'path-params-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -22,7 +22,7 @@ describe('Oas3 paths-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'paths-kebab-case': 'error' }), config: await makeConfig({ rules: { 'paths-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -61,7 +61,7 @@ describe('Oas3 paths-kebab-case', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'paths-kebab-case': 'error' }), config: await makeConfig({ rules: { 'paths-kebab-case': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -99,8 +99,10 @@ describe('Oas3 paths-kebab-case', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'paths-kebab-case': 'error', rules: {
'no-path-trailing-slash': 'off', 'paths-kebab-case': 'error',
'no-path-trailing-slash': 'off',
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -24,7 +24,7 @@ describe('Oas3 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -68,7 +68,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -111,7 +111,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -140,7 +140,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -174,7 +174,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -199,7 +199,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -230,7 +230,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -256,7 +256,7 @@ describe('Oas3.1 scalar-property-missing-example', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'scalar-property-missing-example': 'error' }), config: await makeConfig({ rules: { 'scalar-property-missing-example': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -19,7 +19,7 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': 'error' }), config: await makeConfig({ rules: { 'security-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -53,7 +53,7 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': 'error' }), config: await makeConfig({ rules: { 'security-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -73,7 +73,7 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': 'error' }), config: await makeConfig({ rules: { 'security-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -112,7 +112,7 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': 'error' }), config: await makeConfig({ rules: { 'security-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -167,7 +167,7 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': 'error' }), config: await makeConfig({ rules: { 'security-defined': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -190,7 +190,9 @@ describe('Oas3 security-defined', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'security-defined': { exceptions: [{ path: '/excluded' }] }, rules: {
'security-defined': { exceptions: [{ path: '/excluded' }] },
},
}), }),
}); });
@@ -217,7 +219,9 @@ describe('Oas3 security-defined', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'security-defined': { exceptions: [{ path: '/partially-excluded', methods: ['GET'] }] }, rules: {
'security-defined': { exceptions: [{ path: '/partially-excluded', methods: ['GET'] }] },
},
}), }),
}); });
@@ -254,7 +258,9 @@ describe('Oas3 security-defined', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'security-defined': { exceptions: [{ path: '/excluded' }] } }), config: await makeConfig({
rules: { 'security-defined': { exceptions: [{ path: '/excluded' }] } },
}),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -33,7 +33,7 @@ describe('Oas3 spec-strict-refs', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'spec-strict-refs': 'error' }), config: await makeConfig({ rules: { 'spec-strict-refs': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[ [

View File

@@ -25,7 +25,7 @@ describe('Oas3 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -85,7 +85,7 @@ describe('Oas3 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -157,7 +157,7 @@ describe('Oas3 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -231,7 +231,7 @@ describe('Oas3 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -322,7 +322,7 @@ describe('Oas3 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -384,7 +384,7 @@ describe('Oas3.1 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -432,7 +432,7 @@ describe('Oas3.1 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -486,7 +486,7 @@ describe('Oas3.1 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -557,7 +557,7 @@ describe('Oas3.1 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -632,7 +632,7 @@ describe('Oas3.1 spec', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ spec: 'error' }), config: await makeConfig({ rules: { spec: 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -19,7 +19,7 @@ describe('Oas3 tag-description', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tag-description': 'error' }), config: await makeConfig({ rules: { 'tag-description': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -57,7 +57,7 @@ describe('Oas3 tag-description', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tag-description': 'error' }), config: await makeConfig({ rules: { 'tag-description': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -19,7 +19,7 @@ describe('Oas3 tags-alphabetical', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tags-alphabetical': 'error' }), config: await makeConfig({ rules: { 'tags-alphabetical': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -56,7 +56,7 @@ describe('Oas3 tags-alphabetical', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tags-alphabetical': 'error' }), config: await makeConfig({ rules: { 'tags-alphabetical': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -77,7 +77,7 @@ describe('Oas3 tags-alphabetical', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tags-alphabetical': 'error' }), config: await makeConfig({ rules: { 'tags-alphabetical': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -114,7 +114,9 @@ describe('Oas3 tags-alphabetical', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'tags-alphabetical': { severity: 'error', ignoreCase: true } }), config: await makeConfig({
rules: { 'tags-alphabetical': { severity: 'error', ignoreCase: true } },
}),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -21,7 +21,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }), config: await makeConfig({ rules: { 'boolean-parameter-prefixes': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -73,7 +73,7 @@ describe('oas2 boolean-parameter-prefixes', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }), config: await makeConfig({ rules: { 'boolean-parameter-prefixes': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -98,9 +98,11 @@ describe('oas2 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'boolean-parameter-prefixes': { rules: {
severity: 'error', 'boolean-parameter-prefixes': {
prefixes: ['should'], severity: 'error',
prefixes: ['should'],
},
}, },
}), }),
}); });

View File

@@ -29,9 +29,11 @@ describe('Oas2 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '2xx': ['Content-Length'], '4xx': ['Content-Length'] }, severity: 'error',
names: { '2xx': ['Content-Length'], '4xx': ['Content-Length'] },
},
}, },
}), }),
}); });
@@ -136,9 +138,11 @@ describe('Oas2 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '2xx': ['Content-Length'], '400': ['Content-Length'] }, severity: 'error',
names: { '2xx': ['Content-Length'], '400': ['Content-Length'] },
},
}, },
}), }),
}); });
@@ -164,8 +168,10 @@ describe('Oas2 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
severity: 'error',
},
}, },
}), }),
}); });

View File

@@ -35,9 +35,11 @@ describe('Oas2 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '2xx': ['id'], '4xx': ['id'] }, severity: 'error',
names: { '2xx': ['id'], '4xx': ['id'] },
},
}, },
}), }),
}); });
@@ -117,9 +119,11 @@ describe('Oas2 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '200': ['id'], '4xx': ['id'] }, severity: 'error',
names: { '200': ['id'], '4xx': ['id'] },
},
}, },
}), }),
}); });
@@ -145,8 +149,10 @@ describe('Oas2 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
severity: 'error',
},
}, },
}), }),
}); });

View File

@@ -26,7 +26,9 @@ describe('Referenceable scalars', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
spec: 'error', rules: {
spec: 'error',
},
}), }),
}); });

View File

@@ -30,7 +30,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error', in: ['query'] }, rules: {
'array-parameter-serialization': { severity: 'error', in: ['query'] },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -73,7 +75,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error', in: ['query'] }, rules: {
'array-parameter-serialization': { severity: 'error', in: ['query'] },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -126,7 +130,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error', in: ['query'] }, rules: {
'array-parameter-serialization': { severity: 'error', in: ['query'] },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -170,7 +176,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error', in: ['query'] }, rules: {
'array-parameter-serialization': { severity: 'error', in: ['query'] },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -194,7 +202,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error', in: ['query'] }, rules: {
'array-parameter-serialization': { severity: 'error', in: ['query'] },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -226,7 +236,9 @@ describe('oas3 array-parameter-serialization', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'array-parameter-serialization': { severity: 'error' }, rules: {
'array-parameter-serialization': { severity: 'error' },
},
}), }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -22,7 +22,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }), config: await makeConfig({ rules: { 'boolean-parameter-prefixes': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -74,7 +74,7 @@ describe('oas3 boolean-parameter-prefixes', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'boolean-parameter-prefixes': 'error' }), config: await makeConfig({ rules: { 'boolean-parameter-prefixes': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -99,9 +99,11 @@ describe('oas3 boolean-parameter-prefixes', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'boolean-parameter-prefixes': { rules: {
severity: 'error', 'boolean-parameter-prefixes': {
prefixes: ['should'], severity: 'error',
prefixes: ['should'],
},
}, },
}), }),
}); });

View File

@@ -24,7 +24,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -78,7 +78,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -117,7 +117,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -141,7 +141,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -168,7 +168,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -197,7 +197,7 @@ describe('Oas3 as3-no-server-variables-empty-enum', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-variables-empty-enum': 'error' }), config: await makeConfig({ rules: { 'no-server-variables-empty-enum': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -20,7 +20,7 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-example-value-and-externalValue': 'error' }), config: await makeConfig({ rules: { 'no-example-value-and-externalValue': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -57,7 +57,7 @@ describe('Oas3 oas3-no-example-value-and-externalValue', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-example-value-and-externalValue': 'error' }), config: await makeConfig({ rules: { 'no-example-value-and-externalValue': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -33,7 +33,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -107,9 +107,11 @@ describe('no-invalid-media-type-examples', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-invalid-media-type-examples': { rules: {
severity: 'error', 'no-invalid-media-type-examples': {
allowAdditionalProperties: false, severity: 'error',
allowAdditionalProperties: false,
},
}, },
}), }),
}); });
@@ -159,9 +161,11 @@ describe('no-invalid-media-type-examples', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-invalid-media-type-examples': { rules: {
severity: 'error', 'no-invalid-media-type-examples': {
allowAdditionalProperties: false, severity: 'error',
allowAdditionalProperties: false,
},
}, },
}), }),
}); });
@@ -219,9 +223,11 @@ describe('no-invalid-media-type-examples', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-invalid-media-type-examples': { rules: {
severity: 'error', 'no-invalid-media-type-examples': {
allowAdditionalProperties: false, severity: 'error',
allowAdditionalProperties: false,
},
}, },
}), }),
}); });
@@ -268,9 +274,11 @@ describe('no-invalid-media-type-examples', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-invalid-media-type-examples': { rules: {
severity: 'error', 'no-invalid-media-type-examples': {
allowAdditionalProperties: false, severity: 'error',
allowAdditionalProperties: false,
},
}, },
}), }),
}); });
@@ -318,9 +326,11 @@ describe('no-invalid-media-type-examples', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'no-invalid-media-type-examples': { rules: {
severity: 'error', 'no-invalid-media-type-examples': {
allowAdditionalProperties: false, severity: 'error',
allowAdditionalProperties: false,
},
}, },
}), }),
}); });
@@ -370,7 +380,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -402,7 +412,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -437,7 +447,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -465,7 +475,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -517,7 +527,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -551,7 +561,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -588,7 +598,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -625,7 +635,7 @@ describe('no-invalid-media-type-examples', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-invalid-media-type-examples': 'error' }), config: await makeConfig({ rules: { 'no-invalid-media-type-examples': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -17,7 +17,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-example.com': 'error' }), config: await makeConfig({ rules: { 'no-server-example.com': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -52,7 +52,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-example.com': 'error' }), config: await makeConfig({ rules: { 'no-server-example.com': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -71,7 +71,7 @@ describe('Oas3 oas3-no-server-example.com', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-example.com': 'error' }), config: await makeConfig({ rules: { 'no-server-example.com': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -17,7 +17,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-server-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
@@ -52,7 +52,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-server-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);
@@ -71,7 +71,7 @@ describe('Oas3 oas3-no-server-trailing-slash', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-server-trailing-slash': 'error' }), config: await makeConfig({ rules: { 'no-server-trailing-slash': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`);

View File

@@ -42,7 +42,7 @@ describe('Oas3 no-unused-components', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'no-unused-components': 'error' }), config: await makeConfig({ rules: { 'no-unused-components': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`

View File

@@ -32,7 +32,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-problem-details-rfc7807': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[ [
@@ -79,7 +79,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-problem-details-rfc7807': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[ [
@@ -122,7 +122,7 @@ describe('Oas3 operation-4xx-problem-details-rfc7807', () => {
const results = await lintDocument({ const results = await lintDocument({
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ 'operation-4xx-problem-details-rfc7807': 'error' }), config: await makeConfig({ rules: { 'operation-4xx-problem-details-rfc7807': 'error' } }),
}); });
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`
[ [

View File

@@ -27,9 +27,11 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '200': ['Content-Length'] }, severity: 'error',
names: { '200': ['Content-Length'] },
},
}, },
}), }),
}); });
@@ -107,11 +109,13 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { severity: 'error',
'2XX': ['x-request-id'], names: {
'400': ['Content-Length'], '2XX': ['x-request-id'],
'400': ['Content-Length'],
},
}, },
}, },
}), }),
@@ -259,11 +263,13 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { severity: 'error',
'2xx': ['x-request-id'], names: {
'400': ['Content-Length'], '2xx': ['x-request-id'],
'400': ['Content-Length'],
},
}, },
}, },
}), }),
@@ -294,9 +300,11 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '2XX': ['x-test-header'] }, severity: 'error',
names: { '2XX': ['x-test-header'] },
},
}, },
}), }),
}); });
@@ -326,9 +334,11 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '2XX': ['X-Test-Header'] }, severity: 'error',
names: { '2XX': ['X-Test-Header'] },
},
}, },
}), }),
}); });
@@ -352,9 +362,11 @@ describe('Oas3 response-contains-header', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-header': { rules: {
severity: 'error', 'response-contains-header': {
names: { '2XX': ['X-Test-Header'] }, severity: 'error',
names: { '2XX': ['X-Test-Header'] },
},
}, },
}), }),
}); });

View File

@@ -27,9 +27,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { 201: ['id'] }, severity: 'error',
names: { 201: ['id'] },
},
}, },
}), }),
}); });
@@ -103,9 +105,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '2xx': ['id'], '400': ['error'] }, severity: 'error',
names: { '2xx': ['id'], '400': ['error'] },
},
}, },
}), }),
}); });
@@ -231,9 +235,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '2xx': ['id'], '400': ['error'] }, severity: 'error',
names: { '2xx': ['id'], '400': ['error'] },
},
}, },
}), }),
}); });
@@ -259,9 +265,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { 201: ['id'] }, severity: 'error',
names: { 201: ['id'] },
},
}, },
}), }),
}); });
@@ -300,8 +308,10 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
severity: 'error',
},
}, },
}), }),
}); });
@@ -331,9 +341,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '2xx': ['id'] }, severity: 'error',
names: { '2xx': ['id'] },
},
}, },
}), }),
}); });
@@ -360,9 +372,11 @@ describe('Oas3 response-contains-property', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'response-contains-property': { rules: {
severity: 'error', 'response-contains-property': {
names: { '2xx': ['id'] }, severity: 'error',
names: { '2xx': ['id'] },
},
}, },
}), }),
}); });

View File

@@ -31,7 +31,9 @@ describe('Oas3 spec-components-invalid-map-name', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'spec-components-invalid-map-name': 'error', rules: {
'spec-components-invalid-map-name': 'error',
},
}), }),
}); });
@@ -208,7 +210,9 @@ describe('Oas3 spec-components-invalid-map-name', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'spec-components-invalid-map-name': 'error', rules: {
'spec-components-invalid-map-name': 'error',
},
}), }),
}); });
@@ -235,7 +239,9 @@ describe('Oas3 spec-components-invalid-map-name', () => {
externalRefResolver: new BaseResolver(), externalRefResolver: new BaseResolver(),
document, document,
config: await makeConfig({ config: await makeConfig({
'spec-components-invalid-map-name': 'error', rules: {
'spec-components-invalid-map-name': 'error',
},
}), }),
}); });

View File

@@ -18,6 +18,6 @@ export async function lintDocumentForTest(
return await lintDocument({ return await lintDocument({
externalRefResolver: baseResolver, externalRefResolver: baseResolver,
document, document,
config: await makeConfig(rules), config: await makeConfig({ rules }),
}); });
} }

View File

@@ -0,0 +1,17 @@
import type { ArazzoRule } from '../../visitors';
import type { UserContext } from '../../walk';
export const ParametersNoBodyInsideIn: ArazzoRule = () => {
return {
Parameter: {
enter(parameter, { report, location }: UserContext) {
if (parameter.in === 'body') {
report({
message: 'The `body` value of the `in` property is not supported by Spot.',
location: location.child(['in']),
});
}
},
},
};
};

View File

@@ -1,220 +1,254 @@
import { getNodeTypesFromJSONSchema } from './json-schema-adapter'; import { mapOf, type NodeType, listOf } from '.';
import { DependentRequired, Schema, SchemaProperties } from './oas3_1';
import { Discriminator, DiscriminatorMapping, ExternalDocs, Xml } from './oas3';
import type { NodeType } from '.'; const Root: NodeType = {
export const ARAZZO_ROOT_TYPE = 'Root';
export const operationMethod = {
type: 'string',
enum: ['get', 'post', 'put', 'delete', 'patch'],
} as const;
export const expectSchema = {
type: 'object',
properties: { properties: {
statusCode: { type: 'number' }, arazzo: { type: 'string', enum: ['1.0.0'] },
mimeType: { type: 'string' }, info: 'Info',
body: {}, sourceDescriptions: 'SourceDescriptions',
schema: { 'x-parameters': 'Parameters',
type: 'object', workflows: 'Workflows',
additionalProperties: true, components: 'Components',
},
}, },
additionalProperties: false, required: ['arazzo', 'info', 'sourceDescriptions', 'workflows'],
oneOf: [ extensionsPrefix: 'x-',
{ required: ['statusCode'] }, };
{ required: ['mimeType'] }, const NamedParameters: NodeType = {
{ required: ['body'] }, properties: {},
{ required: ['schema'] }, additionalProperties: 'Parameter',
], };
} as const; const NamedSuccessActions: NodeType = {
const openAPISourceDescriptionSchema = { properties: {},
type: 'object', additionalProperties: 'SuccessActionObject',
};
const NamedFailureActions: NodeType = {
properties: {},
additionalProperties: 'FailureActionObject',
};
const Components: NodeType = {
properties: { properties: {
name: { type: 'string' }, inputs: 'NamedInputs',
type: { type: 'string', enum: ['openapi'] }, parameters: 'NamedParameters',
url: { type: 'string' }, successActions: 'NamedSuccessActions',
'x-serverUrl': { type: 'string' }, failureActions: 'NamedFailureActions',
}, },
additionalProperties: false, extensionsPrefix: 'x-',
required: ['name', 'type', 'url'], };
} as const; const NamedInputs: NodeType = mapOf('Schema');
const noneSourceDescriptionSchema = { const Info: NodeType = {
type: 'object',
properties: {
name: { type: 'string' },
type: { type: 'string', enum: ['none'] },
'x-serverUrl': { type: 'string' },
},
additionalProperties: false,
required: ['name', 'type', 'x-serverUrl'],
} as const;
const arazzoSourceDescriptionSchema = {
type: 'object',
properties: {
name: { type: 'string' },
type: { type: 'string', enum: ['arazzo'] },
url: { type: 'string' },
},
additionalProperties: false,
required: ['name', 'type', 'url'],
} as const;
export const sourceDescriptionSchema = {
type: 'object',
oneOf: [
openAPISourceDescriptionSchema,
noneSourceDescriptionSchema,
arazzoSourceDescriptionSchema,
],
} as const;
const sourceDescriptionsSchema = {
type: 'array',
items: sourceDescriptionSchema,
} as const;
const extendedOperation = {
type: 'object',
properties: {
path: { type: 'string' },
method: operationMethod,
sourceDescriptionName: { type: 'string' },
serverUrl: { type: 'string' },
},
additionalProperties: false,
required: ['path', 'method'],
} as const;
export const parameter = {
type: 'object',
oneOf: [
{
type: 'object',
properties: {
in: { type: 'string', enum: ['header', 'query', 'path', 'cookie', 'body'] },
name: { type: 'string' },
value: {
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
},
},
required: ['name', 'value'],
additionalProperties: false,
},
{
type: 'object',
properties: {
reference: { type: 'string' },
value: {
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }],
},
},
required: ['reference'],
additionalProperties: false,
},
],
} as const;
const parameters = {
type: 'array',
items: parameter,
} as const;
export const infoObject = {
type: 'object',
properties: { properties: {
title: { type: 'string' }, title: { type: 'string' },
description: { type: 'string' }, description: { type: 'string' },
summary: { type: 'string' }, summary: { type: 'string' },
version: { type: 'string' }, version: { type: 'string' },
}, },
additionalProperties: false,
required: ['title', 'version'], required: ['title', 'version'],
} as const; extensionsPrefix: 'x-',
export const replacement = { };
type: 'object', const SourceDescriptions: NodeType = {
properties: {},
items: (value: any) => {
if (value?.type === 'openapi') {
return 'OpenAPISourceDescription';
} else if (value?.type === 'arazzo') {
return 'ArazzoSourceDescription';
} else {
return 'NoneSourceDescription';
}
},
};
const OpenAPISourceDescription: NodeType = {
properties: { properties: {
target: { type: 'string' }, name: { type: 'string' },
type: { type: 'string', enum: ['openapi'] },
url: { type: 'string' },
'x-serverUrl': { type: 'string' },
},
required: ['name', 'type', 'url'],
extensionsPrefix: 'x-',
};
const NoneSourceDescription: NodeType = {
properties: {
name: { type: 'string' },
type: { type: 'string', enum: ['none'] },
'x-serverUrl': { type: 'string' },
},
required: ['name', 'type', 'x-serverUrl'],
extensionsPrefix: 'x-',
};
const ArazzoSourceDescription: NodeType = {
properties: {
name: { type: 'string' },
type: { type: 'string', enum: ['arazzo'] },
url: { type: 'string' },
},
required: ['name', 'type', 'url'],
extensionsPrefix: 'x-',
};
const ReusableObject: NodeType = {
properties: {
reference: { type: 'string' },
value: { value: {
oneOf: [ type: 'string',
{ type: 'string' },
{ type: 'object' },
{ type: 'array' },
{ type: 'number' },
{ type: 'boolean' },
],
}, },
}, },
} as const; required: ['reference'],
export const requestBody = { extensionsPrefix: 'x-',
type: 'object', };
const Parameter: NodeType = {
properties: {
in: { type: 'string', enum: ['header', 'query', 'path', 'cookie', 'body'] },
name: { type: 'string' },
value: {}, // any
},
required: ['name', 'value'],
extensionsPrefix: 'x-',
};
const Parameters: NodeType = {
properties: {},
items: (value: any) => {
if (value?.in) {
return 'Parameter';
} else {
return 'ReusableObject';
}
},
};
const Workflow: NodeType = {
properties: {
workflowId: { type: 'string' },
summary: { type: 'string' },
description: { type: 'string' },
parameters: 'Parameters',
dependsOn: { type: 'array', items: { type: 'string' } },
inputs: 'NamedInputs',
outputs: 'Outputs',
steps: 'Steps',
successActions: 'OnSuccessActionList',
failureActions: 'OnFailureActionList',
},
required: ['workflowId', 'steps'],
extensionsPrefix: 'x-',
};
const Workflows: NodeType = listOf('Workflow');
const Steps: NodeType = listOf('Step');
const Step: NodeType = {
properties: {
stepId: { type: 'string' },
description: { type: 'string' },
operationId: { type: 'string' },
operationPath: { type: 'string' },
workflowId: { type: 'string' },
parameters: 'Parameters',
successCriteria: listOf('CriterionObject'),
onSuccess: 'OnSuccessActionList',
onFailure: 'OnFailureActionList',
outputs: 'Outputs',
'x-inherit': { enum: ['auto', 'none'] },
'x-expect': 'ExpectSchema',
'x-assert': { type: 'string' },
'x-operation': 'ExtendedOperation',
requestBody: 'RequestBody',
},
required: ['stepId'],
requiredOneOf: ['x-operation', 'operationId', 'operationPath', 'workflowId'],
extensionsPrefix: 'x-',
};
const Outputs: NodeType = {
properties: {},
additionalProperties: {
type: 'string',
},
};
const RequestBody: NodeType = {
properties: { properties: {
contentType: { type: 'string' }, contentType: { type: 'string' },
payload: { payload: {},
oneOf: [ replacements: listOf('Replacement'),
{ type: 'string' },
{ type: 'object', additionalProperties: true },
{ type: 'array' },
{ type: 'number' },
{ type: 'boolean' },
],
},
encoding: { type: 'string' },
replacements: {
type: 'array',
items: replacement,
},
}, },
additionalProperties: false,
required: ['payload'], required: ['payload'],
} as const; extensionsPrefix: 'x-',
export const criteriaObject = { };
type: 'object', const Replacement: NodeType = {
properties: {
target: { type: 'string' },
value: {},
},
required: ['target', 'value'],
extensionsPrefix: 'x-',
};
const ExtendedOperation: NodeType = {
properties: {
path: { type: 'string' },
method: {
enum: ['get', 'post', 'put', 'delete', 'patch'],
},
sourceDescriptionName: { type: 'string' },
serverUrl: { type: 'string' },
},
required: ['path', 'method'],
};
const ExpectSchema: NodeType = {
properties: {
statusCode: { type: 'number' },
mimeType: { type: 'string' },
body: {},
schema: 'Schema',
},
requiredOneOf: ['statusCode', 'mimeType', 'body', 'schema'],
};
const CriterionObject: NodeType = {
properties: { properties: {
condition: { type: 'string' }, condition: { type: 'string' },
context: { type: 'string' }, context: { type: 'string' },
type: { type: (value: any) => {
oneOf: [ if (!value) {
{ type: 'string', enum: ['regex', 'jsonpath', 'simple', 'xpath'] }, return undefined;
{ } else if (typeof value === 'string') {
type: 'object', return { enum: ['regex', 'jsonpath', 'simple', 'xpath'] };
properties: { } else if (value.type === 'jsonpath') {
type: { type: 'string', enum: ['jsonpath'] }, return 'JSONPathCriterion';
version: { type: 'string', enum: ['draft-goessner-dispatch-jsonpath-00'] }, } else {
}, return 'XPathCriterion';
}, }
{
type: 'object',
properties: {
type: { type: 'string', enum: ['xpath'] },
version: { type: 'string', enum: ['xpath-30', 'xpath-20', 'xpath-10'] },
},
},
],
}, },
}, },
required: ['condition'], required: ['condition'],
additionalProperties: false, };
} as const; const JSONPathCriterion: NodeType = {
const criteriaObjects = { properties: {
type: 'array', type: { type: 'string', enum: ['jsonpath'] },
items: criteriaObject, version: { type: 'string', enum: ['draft-goessner-dispatch-jsonpath-00'] },
} as const; },
export const inherit = { };
type: 'string', const XPathCriterion: NodeType = {
enum: ['auto', 'none'], properties: {
} as const; type: { type: 'string', enum: ['xpath'] },
const onSuccessObject = { version: { type: 'string', enum: ['xpath-30', 'xpath-20', 'xpath-10'] },
type: 'object', },
};
const SuccessActionObject: NodeType = {
properties: { properties: {
name: { type: 'string' }, name: { type: 'string' },
type: { type: 'string', enum: ['goto', 'end'] }, type: { type: 'string', enum: ['goto', 'end'] },
stepId: { type: 'string' }, stepId: { type: 'string' },
workflowId: { type: 'string' }, workflowId: { type: 'string' },
criteria: criteriaObjects, criteria: 'CriterionObject',
}, },
additionalProperties: false,
required: ['type', 'name'], required: ['type', 'name'],
} as const; };
const onSuccessList = { const OnSuccessActionList: NodeType = {
type: 'array', properties: {},
items: onSuccessObject, items: (value: any) => {
} as const; if (value?.type && value?.name) {
const onFailureObject = { return 'SuccessActionObject';
type: 'object', } else {
return 'ReusableObject';
}
},
};
const FailureActionObject: NodeType = {
properties: { properties: {
name: { type: 'string' }, name: { type: 'string' },
type: { type: 'string', enum: ['goto', 'retry', 'end'] }, type: { type: 'string', enum: ['goto', 'retry', 'end'] },
@@ -222,170 +256,59 @@ const onFailureObject = {
stepId: { type: 'string' }, stepId: { type: 'string' },
retryAfter: { type: 'number' }, retryAfter: { type: 'number' },
retryLimit: { type: 'number' }, retryLimit: { type: 'number' },
criteria: criteriaObjects, criteria: 'CriterionObject',
}, },
additionalProperties: false,
required: ['type', 'name'], required: ['type', 'name'],
} as const; };
const onFailureList = { const OnFailureActionList: NodeType = {
type: 'array', properties: {},
items: onFailureObject, items: (value: any) => {
} as const; if (value?.type && value?.name) {
export const step = { return 'FailureActionObject';
type: 'object', } else {
properties: { return 'ReusableObject';
stepId: { type: 'string' }, }
description: { type: 'string' },
operationId: { type: 'string' },
operationPath: { type: 'string' },
workflowId: { type: 'string' },
parameters: parameters,
successCriteria: criteriaObjects,
onSuccess: onSuccessList,
onFailure: onFailureList,
outputs: {
type: 'object',
additionalProperties: {
oneOf: [
{
type: 'string',
},
{
type: 'object',
},
{
type: 'array',
},
{
type: 'boolean',
},
{
type: 'number',
},
],
},
},
'x-inherit': inherit,
'x-expect': expectSchema,
'x-assert': { type: 'string' },
'x-operation': extendedOperation,
requestBody: requestBody,
}, },
required: ['stepId'], };
oneOf: [
{ required: ['x-operation'] },
{ required: ['operationId'] },
{ required: ['operationPath'] },
{ required: ['workflowId'] },
],
} as const;
const steps = {
type: 'array',
items: step,
} as const;
const JSONSchema = {
type: 'object',
properties: {
type: {
type: 'string',
enum: ['object', 'array', 'string', 'number', 'integer', 'boolean', 'null'],
},
properties: {
type: 'object',
additionalProperties: true,
},
required: {
type: 'array',
items: { type: 'string' },
},
items: {
type: 'object',
additionalProperties: true,
},
},
required: ['type'],
additionalProperties: true,
} as const;
export const workflow = {
type: 'object',
properties: {
workflowId: { type: 'string' },
summary: { type: 'string' },
description: { type: 'string' },
parameters: parameters,
dependsOn: { type: 'array', items: { type: 'string' } },
inputs: JSONSchema,
outputs: {
type: 'object',
additionalProperties: {
type: 'string',
},
},
steps: steps,
successActions: {
type: 'array',
items: onSuccessObject,
},
failureActions: {
type: 'array',
items: onFailureObject,
},
},
additionalProperties: false,
required: ['workflowId', 'steps'],
} as const;
const workflows = {
type: 'array',
items: workflow,
} as const;
export const arazzoSchema = {
type: 'object',
properties: {
arazzo: { type: 'string', enum: ['1.0.0'] },
info: infoObject,
sourceDescriptions: sourceDescriptionsSchema,
'x-parameters': parameters,
workflows: workflows,
components: {
type: 'object',
properties: {
inputs: {
type: 'object',
additionalProperties: {
type: 'object',
additionalProperties: true,
properties: {
type: {
type: 'string',
},
properties: {
type: 'object',
additionalProperties: true,
},
},
required: ['type'],
},
},
parameters: {
type: 'object',
additionalProperties: parameter,
},
successActions: {
type: 'object',
additionalProperties: onSuccessObject,
},
failureActions: {
type: 'object',
additionalProperties: onFailureObject,
},
},
},
},
additionalProperties: false,
required: ['arazzo', 'info', 'sourceDescriptions', 'workflows'],
} as const;
export const ArazzoTypes: Record<string, NodeType> = getNodeTypesFromJSONSchema( export const ArazzoTypes: Record<string, NodeType> = {
ARAZZO_ROOT_TYPE, Root,
arazzoSchema Info,
); SourceDescriptions,
OpenAPISourceDescription,
NoneSourceDescription,
ArazzoSourceDescription,
Parameters,
Parameter,
ReusableObject,
Workflows,
Workflow,
Steps,
Step,
RequestBody,
Replacement,
ExtendedOperation,
ExpectSchema,
Outputs,
CriterionObject,
XPathCriterion,
JSONPathCriterion,
SuccessActionObject,
OnSuccessActionList,
FailureActionObject,
OnFailureActionList,
Schema,
NamedSchemas: mapOf('Schema'),
ExternalDocs,
DiscriminatorMapping,
Discriminator,
DependentRequired,
SchemaProperties,
PatternProperties: SchemaProperties,
Components,
NamedInputs,
NamedParameters,
NamedSuccessActions,
NamedFailureActions,
Xml,
};

View File

@@ -44,7 +44,7 @@ const TagGroup: NodeType = {
extensionsPrefix: 'x-', extensionsPrefix: 'x-',
}; };
const ExternalDocs: NodeType = { export const ExternalDocs: NodeType = {
properties: { properties: {
description: { type: 'string' }, description: { type: 'string' },
url: { type: 'string' }, url: { type: 'string' },
@@ -369,7 +369,7 @@ const Schema: NodeType = {
extensionsPrefix: 'x-', extensionsPrefix: 'x-',
}; };
const Xml: NodeType = { export const Xml: NodeType = {
properties: { properties: {
name: { type: 'string' }, name: { type: 'string' },
namespace: { type: 'string' }, namespace: { type: 'string' },
@@ -385,7 +385,7 @@ const SchemaProperties: NodeType = {
additionalProperties: 'Schema', additionalProperties: 'Schema',
}; };
const DiscriminatorMapping: NodeType = { export const DiscriminatorMapping: NodeType = {
properties: {}, properties: {},
additionalProperties: (value: any) => { additionalProperties: (value: any) => {
if (isMappingRef(value)) { if (isMappingRef(value)) {
@@ -396,7 +396,7 @@ const DiscriminatorMapping: NodeType = {
}, },
}; };
const Discriminator: NodeType = { export const Discriminator: NodeType = {
properties: { properties: {
propertyName: { type: 'string' }, propertyName: { type: 'string' },
mapping: 'DiscriminatorMapping', mapping: 'DiscriminatorMapping',

View File

@@ -87,7 +87,7 @@ const Operation: NodeType = {
extensionsPrefix: 'x-', extensionsPrefix: 'x-',
}; };
const Schema: NodeType = { export const Schema: NodeType = {
properties: { properties: {
$id: { type: 'string' }, $id: { type: 'string' },
$anchor: { type: 'string' }, $anchor: { type: 'string' },
@@ -186,7 +186,7 @@ const Schema: NodeType = {
extensionsPrefix: 'x-', extensionsPrefix: 'x-',
}; };
const SchemaProperties: NodeType = { export const SchemaProperties: NodeType = {
properties: {}, properties: {},
additionalProperties: (value: any) => { additionalProperties: (value: any) => {
if (typeof value === 'boolean') { if (typeof value === 'boolean') {
@@ -267,7 +267,7 @@ const SecurityScheme: NodeType = {
extensionsPrefix: 'x-', extensionsPrefix: 'x-',
}; };
const DependentRequired: NodeType = { export const DependentRequired: NodeType = {
properties: {}, properties: {},
additionalProperties: { type: 'array', items: { type: 'string' } }, additionalProperties: { type: 'array', items: { type: 'string' } },
}; };

View File

@@ -106,7 +106,7 @@ export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
export type BuiltInAsync3RuleId = typeof builtInAsync3Rules[number]; export type BuiltInAsync3RuleId = typeof builtInAsync3Rules[number];
const builtInArazzoRules = ['spec'] as const; const builtInArazzoRules = ['spec', 'parameters-no-body-inside-in'] as const;
export type BuiltInArazzoRuleId = typeof builtInArazzoRules[number]; export type BuiltInArazzoRuleId = typeof builtInArazzoRules[number];

View File

@@ -1,44 +1,172 @@
import type { FromSchema } from 'json-schema-to-ts'; export interface InfoObject {
import type { title: string;
arazzoSchema, description?: string;
parameter, summary?: string;
operationMethod, version: string;
expectSchema, }
sourceDescriptionSchema,
infoObject,
requestBody,
replacement,
inherit,
criteriaObject,
step,
workflow,
} from '../types/arazzo';
export type ArazzoDefinition = FromSchema<typeof arazzoSchema>; export interface OpenAPISourceDescription {
export type OperationMethod = FromSchema<typeof operationMethod>; name: string;
export type ResponseContext = { type: 'openapi';
statusCode: number; url: string;
body: any; 'x-serverUrl'?: string;
headers: Headers; }
mimeType: string;
} & Record<string, any>; export interface NoneSourceDescription {
export type Expect = FromSchema<typeof expectSchema>; name: string;
export type SourceDescription = FromSchema<typeof sourceDescriptionSchema>; type: 'none';
export type Parameter = FromSchema<typeof parameter>; 'x-serverUrl': string;
export type InfoObject = FromSchema<typeof infoObject>; }
export type RequestBody = FromSchema<typeof requestBody>;
export type Replacement = FromSchema<typeof replacement>; export interface ArazzoSourceDescription {
export type Inherit = FromSchema<typeof inherit>; name: string;
export type CriteriaObject = FromSchema<typeof criteriaObject>; type: 'arazzo';
export type VerboseLog = { url: string;
method: OperationMethod; }
export type SourceDescription =
| OpenAPISourceDescription
| NoneSourceDescription
| ArazzoSourceDescription;
export interface Parameter {
in?: 'header' | 'query' | 'path' | 'cookie' | 'body';
name: string;
value: string | number | boolean;
reference?: string;
}
export interface ExtendedOperation {
path: string; path: string;
host: string; method: 'get' | 'post' | 'put' | 'delete' | 'patch';
body?: any; sourceDescriptionName?: string;
headerParams?: Record<string, string>; serverUrl?: string;
}
export interface ExpectSchema {
statusCode?: number; statusCode?: number;
}; mimeType?: string;
export type Step = FromSchema<typeof step>; body?: any;
export type Workflow = FromSchema<typeof workflow> & { schema?: {
[key: string]: any;
};
}
export interface Replacement {
target: string;
value: string | object | any[];
}
export interface RequestBody {
contentType?: string;
payload: string | object | any[];
encoding?: string;
replacements?: Replacement[];
}
export interface CriteriaObject {
condition: string;
context?: string;
type?:
| 'regex'
| 'jsonpath'
| 'simple'
| 'xpath'
| {
type: 'jsonpath';
version: 'draft-goessner-dispatch-jsonpath-00';
}
| {
type: 'xpath';
version: 'xpath-30' | 'xpath-20' | 'xpath-10';
};
}
export interface OnSuccessObject {
name: string;
type: 'goto' | 'end';
stepId?: string;
workflowId?: string;
criteria?: CriteriaObject[];
}
export interface OnFailureObject {
name: string;
type: 'goto' | 'retry' | 'end';
workflowId?: string;
stepId?: string;
retryAfter?: number;
retryLimit?: number;
criteria?: CriteriaObject[];
}
export interface Step {
stepId: string;
description?: string;
operationId?: string;
operationPath?: string;
workflowId?: string;
parameters?: Parameter[];
successCriteria?: CriteriaObject[];
onSuccess?: OnSuccessObject[];
onFailure?: OnFailureObject[];
outputs?: {
[key: string]: string | object | any[] | boolean | number;
};
'x-inherit'?: 'auto' | 'none';
'x-expect'?: ExpectSchema;
'x-assert'?: string;
'x-operation'?: ExtendedOperation;
requestBody?: RequestBody;
}
export interface Workflow {
workflowId: string;
summary?: string;
description?: string;
parameters?: Parameter[];
dependsOn?: string[];
inputs?: {
type: 'object' | 'array' | 'string' | 'number' | 'integer' | 'boolean' | 'null';
properties?: {
[key: string]: any;
};
required?: string[];
items?: {
[key: string]: any;
};
};
outputs?: {
[key: string]: string;
};
steps: Step[]; steps: Step[];
}; successActions?: OnSuccessObject[];
failureActions?: OnFailureObject[];
}
export interface ArazzoDefinition {
arazzo: '1.0.0';
info: InfoObject;
sourceDescriptions: SourceDescription[];
'x-parameters'?: Parameter[];
workflows: Workflow[];
components?: {
inputs?: {
[key: string]: {
type: string;
properties?: {
[key: string]: any;
};
};
};
parameters?: {
[key: string]: Parameter;
};
successActions?: {
[key: string]: OnSuccessObject;
};
failureActions?: {
[key: string]: OnFailureObject;
};
};
}

View File

@@ -51,7 +51,24 @@ import type {
} from './typings/swagger'; } from './typings/swagger';
import type { Async2Definition } from './typings/asyncapi'; import type { Async2Definition } from './typings/asyncapi';
import type { Async3Definition } from './typings/asyncapi3'; import type { Async3Definition } from './typings/asyncapi3';
import type { ArazzoDefinition } from './typings/arazzo'; import type {
ArazzoDefinition,
ArazzoSourceDescription,
CriteriaObject,
ExpectSchema,
ExtendedOperation,
InfoObject,
NoneSourceDescription,
OnFailureObject,
OnSuccessObject,
OpenAPISourceDescription,
Parameter,
Replacement,
RequestBody,
SourceDescription,
Step,
Workflow,
} from './typings/arazzo';
export type SkipFunctionContext = Pick< export type SkipFunctionContext = Pick<
UserContext, UserContext,
@@ -220,6 +237,23 @@ type Async3FlatVisitor = {
type ArazzoFlatVisitor = { type ArazzoFlatVisitor = {
Root?: VisitFunctionOrObject<ArazzoDefinition>; Root?: VisitFunctionOrObject<ArazzoDefinition>;
ParameterObject?: VisitFunctionOrObject<Parameter>;
InfoObject?: VisitFunctionOrObject<InfoObject>;
OpenAPISourceDescription?: VisitFunctionOrObject<OpenAPISourceDescription>;
NoneSourceDescription?: VisitFunctionOrObject<NoneSourceDescription>;
ArazzoSourceDescription?: VisitFunctionOrObject<ArazzoSourceDescription>;
SourceDescription?: VisitFunctionOrObject<SourceDescription>;
ExtendedOperation?: VisitFunctionOrObject<ExtendedOperation>;
ExpectSchema?: VisitFunctionOrObject<ExpectSchema>;
Replacement?: VisitFunctionOrObject<Replacement>;
RequestBody?: VisitFunctionOrObject<RequestBody>;
CriteriaObject?: VisitFunctionOrObject<CriteriaObject>;
OnSuccessObject?: VisitFunctionOrObject<OnSuccessObject>;
OnFailureObject?: VisitFunctionOrObject<OnFailureObject>;
Step?: VisitFunctionOrObject<Step>;
Steps?: VisitFunctionOrObject<Step[]>;
Workflow?: VisitFunctionOrObject<Workflow>;
Workflows?: VisitFunctionOrObject<Workflow[]>;
}; };
const legacyTypesMap = { const legacyTypesMap = {

119
resources/arazzo.yaml Normal file
View File

@@ -0,0 +1,119 @@
arazzo: 1.0.0
info:
title: Redocly Museum API Test Workflow
description: >-
Use the Museum API with Arazzo as an example of describing multi-step workflows.
Built with love by Redocly.
version: 1.0.0
sourceDescriptions:
- name: museum-api
type: openapi
url: ../openapi.yaml
- name: tickets-from-museum-api
type: arazzo
url: museum-tickets.arazzo.yaml
workflows:
- workflowId: get-museum-hours
description: >-
This workflow demonstrates how to get the museum opening hours and buy tickets.
parameters:
- in: header
name: Authorization
value: Basic Og==
steps:
- stepId: get-museum-hours
description: >-
Get museum hours by resolving request details with getMuseumHours operationId from openapi.yaml description.
operationId: museum-api.getMuseumHours
successCriteria:
- condition: $statusCode == 200
outputs:
schedule: $response.body
- stepId: buy-ticket
description: >-
Buy a ticket for the museum by calling an external workflow from another Arazzo file.
workflowId: $sourceDescriptions.tickets-from-museum-api.workflows.get-museum-tickets
outputs:
ticketId: $outputs.ticketId
- workflowId: events-crud
description: >-
This workflow demonstrates how to list, create, update, and delete special events at the museum.
parameters:
- in: header
name: Authorization
value: Basic Og==
steps:
- stepId: list-events
description: >-
Request the list of events.
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events/get
outputs:
events: $response.body
- stepId: create-event
description: >-
Create a new special event.
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events/post
requestBody:
payload:
name: 'Mermaid Treasure Identification and Analysis'
location: 'Under the seaaa 🦀 🎶 🌊.'
eventDescription: 'Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.'
dates:
- '2023-09-05'
- '2023-09-08'
price: 0
successCriteria:
- condition: $statusCode == 201
- context: $response.body
condition: $.name == 'Mermaid Treasure Identification and Analysis'
type: jsonpath
outputs:
createdEventId: $response.body.eventId
name: $response.body.name
- stepId: get-event-by-id
description: >-
Get the details of the event that was created in the previous step.
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events~1{eventId}/get
parameters:
- name: eventId
in: body
value: $steps.create-event.outputs.createdEventId
successCriteria:
- context: $statusCode
condition: '^200$'
type: regex
- stepId: update-event
description: >-
Update the created event with new details.
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events~1{eventId}/patch
parameters:
- name: eventId
in: path
value: $steps.create-event.outputs.createdEventId
requestBody:
payload:
name: 'Orca Identification and Analysis'
location: 'Under the seaaa 🦀 🎶 🌊.'
dates:
- '2023-09-05'
- '2023-09-08'
price: 0
successCriteria:
- condition: $statusCode == 200
- context: $response.body
condition: $.name == 'Orca Identification and Analysis'
type: jsonpath
outputs:
updatedEventId: $response.body.eventId
- stepId: delete-event
description: >-
Delete the event that was updated in the previous step.
operationPath: $sourceDescriptions.museum-api#/paths/~1special-events~1{eventId}/delete
parameters:
- name: eventId
in: path
value: $steps.update-event.outputs.updatedEventId
successCriteria:
- condition: $statusCode == 204

View File

@@ -0,0 +1,37 @@
arazzo: 1.0.0
info:
title: Redocly Museum Tickets Workflow
description: >-
Use the Museum API as an example in a simple Arazzo workflow.
Built with love by Redocly.
version: 1.0.0
sourceDescriptions:
- name: museum-api
type: openapi
url: ../openapi.yaml
workflows:
- workflowId: get-museum-tickets
description: >-
This workflow demonstrates how to buy tickets for the museum.
parameters:
- in: header
name: Authorization
value: Basic Og==
steps:
- stepId: buy-tickets
description: >-
Buy museum tickets resolving request details with buyMuseumTickets operationId from openapi.yaml description.
operationId: buyMuseumTickets
requestBody:
payload:
ticketType: general
ticketDate: 2023-09-07
email: todd@example.com
successCriteria:
- condition: $statusCode == 201
outputs:
ticketId: $response.body.ticketId
outputs:
ticketId: $steps.buy-tickets.outputs.ticketId

View File

@@ -1,21 +1,22 @@
openapi: 3.1.0 openapi: 3.1.0
info: info:
title: Redocly Museum API title: Redocly Museum API
description: An imaginary, but delightful Museum API for interacting with museum services and information. Built with love by Redocly. description: Imaginary, but delightful Museum API for interacting with museum services and information. Built with love by Redocly.
version: 1.0.0 version: 1.1.1
termsOfService: 'https://redocly.com/subscription-agreement/'
contact: contact:
email: team@redocly.com email: team@redocly.com
url: 'https://redocly.com/docs/cli/' url: 'https://redocly.com/docs/cli/'
license: license:
name: MIT name: MIT
url: 'https://opensource.org/license/mit/ ' url: 'https://opensource.org/license/mit/'
servers: servers:
- url: 'https://api.fake-museum-example.com/v1' - url: 'https://redocly.com/_mock/docs/openapi/museum-api'
paths: paths:
/museum-hours: /museum-hours:
get: get:
summary: Get museum hours summary: Get museum hours
description: Get upcoming museum operating hours description: Get upcoming museum operating hours.
operationId: getMuseumHours operationId: getMuseumHours
tags: tags:
- Operations - Operations
@@ -25,7 +26,7 @@ paths:
- $ref: '#/components/parameters/PaginationLimit' - $ref: '#/components/parameters/PaginationLimit'
responses: responses:
'200': '200':
description: Success description: Success.
content: content:
application/json: application/json:
schema: schema:
@@ -34,9 +35,9 @@ paths:
default_example: default_example:
$ref: '#/components/examples/GetMuseumHoursResponseExample' $ref: '#/components/examples/GetMuseumHoursResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
/special-events: /special-events:
post: post:
summary: Create special events summary: Create special events
@@ -54,8 +55,8 @@ paths:
default_example: default_example:
$ref: '#/components/examples/CreateSpecialEventRequestExample' $ref: '#/components/examples/CreateSpecialEventRequestExample'
responses: responses:
'200': '201':
description: Success description: Created.
content: content:
application/json: application/json:
schema: schema:
@@ -64,9 +65,9 @@ paths:
default_example: default_example:
$ref: '#/components/examples/CreateSpecialEventResponseExample' $ref: '#/components/examples/CreateSpecialEventResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
get: get:
summary: List special events summary: List special events
description: Return a list of upcoming special events at the museum. description: Return a list of upcoming special events at the museum.
@@ -80,7 +81,7 @@ paths:
- $ref: '#/components/parameters/PaginationLimit' - $ref: '#/components/parameters/PaginationLimit'
responses: responses:
'200': '200':
description: Success description: Success.
content: content:
application/json: application/json:
schema: schema:
@@ -89,9 +90,9 @@ paths:
default_example: default_example:
$ref: '#/components/examples/ListSpecialEventsResponseExample' $ref: '#/components/examples/ListSpecialEventsResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
/special-events/{eventId}: /special-events/{eventId}:
get: get:
summary: Get special event summary: Get special event
@@ -103,7 +104,7 @@ paths:
- $ref: '#/components/parameters/EventId' - $ref: '#/components/parameters/EventId'
responses: responses:
'200': '200':
description: Success description: Success.
content: content:
application/json: application/json:
schema: schema:
@@ -112,12 +113,12 @@ paths:
default_example: default_example:
$ref: '#/components/examples/GetSpecialEventResponseExample' $ref: '#/components/examples/GetSpecialEventResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
patch: patch:
summary: Update special event summary: Update special event
description: Update the details of a special event description: Update the details of a special event.
operationId: updateSpecialEvent operationId: updateSpecialEvent
tags: tags:
- Events - Events
@@ -134,7 +135,7 @@ paths:
$ref: '#/components/examples/UpdateSpecialEventRequestExample' $ref: '#/components/examples/UpdateSpecialEventRequestExample'
responses: responses:
'200': '200':
description: Success description: Success.
content: content:
application/json: application/json:
schema: schema:
@@ -143,9 +144,9 @@ paths:
default_example: default_example:
$ref: '#/components/examples/UpdateSpecialEventResponseExample' $ref: '#/components/examples/UpdateSpecialEventResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
delete: delete:
summary: Delete special event summary: Delete special event
description: Delete a special event from the collection. Allows museum to cancel planned events. description: Delete a special event from the collection. Allows museum to cancel planned events.
@@ -156,13 +157,13 @@ paths:
- $ref: '#/components/parameters/EventId' - $ref: '#/components/parameters/EventId'
responses: responses:
'204': '204':
description: Success - no content description: Success - no content.
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'401': '401':
description: Unauthorized $ref: '#/components/responses/Unauthorized'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
/tickets: /tickets:
post: post:
summary: Buy museum tickets summary: Buy museum tickets
@@ -182,8 +183,8 @@ paths:
event_entry: event_entry:
$ref: '#/components/examples/BuyEventTicketsRequestExample' $ref: '#/components/examples/BuyEventTicketsRequestExample'
responses: responses:
'200': '201':
description: Success description: Created.
content: content:
application/json: application/json:
schema: schema:
@@ -194,9 +195,9 @@ paths:
event_entry: event_entry:
$ref: '#/components/examples/BuyEventTicketsResponseExample' $ref: '#/components/examples/BuyEventTicketsResponseExample'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
/tickets/{ticketId}/qr: /tickets/{ticketId}/qr:
get: get:
summary: Get ticket QR code summary: Get ticket QR code
@@ -208,15 +209,15 @@ paths:
- $ref: '#/components/parameters/TicketId' - $ref: '#/components/parameters/TicketId'
responses: responses:
'200': '200':
description: Scannable event ticket in image format description: Scannable event ticket in image format.
content: content:
image/png: image/png:
schema: schema:
$ref: '#/components/schemas/GetTicketCodeResponse' $ref: '#/components/schemas/GetTicketCodeResponse'
'400': '400':
description: Bad request $ref: '#/components/responses/BadRequest'
'404': '404':
description: Not found $ref: '#/components/responses/NotFound'
components: components:
schemas: schemas:
TicketType: TicketType:
@@ -229,7 +230,7 @@ components:
Date: Date:
type: string type: string
format: date format: date
example: 2023-10-29 example: '2023-10-29'
Email: Email:
description: Email address for ticket purchaser. description: Email address for ticket purchaser.
type: string type: string
@@ -238,7 +239,7 @@ components:
Phone: Phone:
description: Phone number for the ticket purchaser (optional). description: Phone number for the ticket purchaser (optional).
type: string type: string
example: +1(234)-567-8910 example: '+1(234)-567-8910'
BuyMuseumTicketsRequest: BuyMuseumTicketsRequest:
description: Request payload used for purchasing museum tickets. description: Request payload used for purchasing museum tickets.
type: object type: object
@@ -271,7 +272,7 @@ components:
TicketConfirmation: TicketConfirmation:
description: Unique confirmation code used to verify ticket purchase. description: Unique confirmation code used to verify ticket purchase.
type: string type: string
example: ticket-event-a98c8f-7eb12 example: 'ticket-event-a98c8f-7eb12'
BuyMuseumTicketsResponse: BuyMuseumTicketsResponse:
description: Details for a museum ticket after a successful purchase. description: Details for a museum ticket after a successful purchase.
type: object type: object
@@ -296,7 +297,7 @@ components:
- ticketDate - ticketDate
- confirmationCode - confirmationCode
GetTicketCodeResponse: GetTicketCodeResponse:
description: An image of a ticket with a QR code used for museum or event entry. description: Image of a ticket with a QR code used for museum or event entry.
type: string type: string
format: binary format: binary
GetMuseumHoursResponse: GetMuseumHoursResponse:
@@ -311,7 +312,7 @@ components:
date: date:
description: Date the operating hours apply to. description: Date the operating hours apply to.
$ref: '#/components/schemas/Date' $ref: '#/components/schemas/Date'
example: 02-02-2022 example: '2024-12-31'
timeOpen: timeOpen:
type: string type: string
pattern: '^([01]\d|2[0-3]):?([0-5]\d)$' pattern: '^([01]\d|2[0-3]):?([0-5]\d)$'
@@ -333,28 +334,29 @@ components:
example: 3be6453c-03eb-4357-ae5a-984a0e574a54 example: 3be6453c-03eb-4357-ae5a-984a0e574a54
EventName: EventName:
type: string type: string
description: Name of the special event description: Name of the special event.
example: Pirate Coding Workshop example: Pirate Coding Workshop
EventLocation: EventLocation:
type: string type: string
description: Location where the special event is held description: Location where the special event is held.
example: Computer Room example: Computer Room
EventDescription: EventDescription:
type: string type: string
description: Description of the special event description: Description of the special event.
example: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang). example: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
EventDates: EventDates:
type: array type: array
items: items:
$ref: '#/components/schemas/Date' $ref: '#/components/schemas/Date'
description: List of planned dates for the special event description: List of planned dates for the special event.
EventPrice: EventPrice:
description: Price of a ticket for the special event description: Price of a ticket for the special event.
type: number type: number
format: float format: float
example: 25 example: 25
CreateSpecialEventRequest: CreateSpecialEventRequest:
description: Request payload for creating new special events at the museum. description: Request payload for creating new special events at the museum.
type: object
properties: properties:
name: name:
$ref: '#/components/schemas/EventName' $ref: '#/components/schemas/EventName'
@@ -374,6 +376,7 @@ components:
- price - price
UpdateSpecialEventRequest: UpdateSpecialEventRequest:
description: Request payload for updating an existing special event. Only included fields are updated in the event. description: Request payload for updating an existing special event. Only included fields are updated in the event.
type: object
properties: properties:
name: name:
$ref: '#/components/schemas/EventName' $ref: '#/components/schemas/EventName'
@@ -386,12 +389,13 @@ components:
price: price:
$ref: '#/components/schemas/EventPrice' $ref: '#/components/schemas/EventPrice'
ListSpecialEventsResponse: ListSpecialEventsResponse:
description: A list of upcoming special events description: List of upcoming special events.
type: array type: array
items: items:
$ref: '#/components/schemas/SpecialEventResponse' $ref: '#/components/schemas/SpecialEventResponse'
SpecialEventResponse: SpecialEventResponse:
description: Information about a special event. description: Information about a special event.
type: object
properties: properties:
eventId: eventId:
$ref: '#/components/schemas/EventId' $ref: '#/components/schemas/EventId'
@@ -412,6 +416,16 @@ components:
- eventDescription - eventDescription
- dates - dates
- price - price
Error:
type: object
properties:
type:
type: string
example: object
title:
type: string
example: Validation failed
securitySchemes: securitySchemes:
MuseumPlaceholderAuth: MuseumPlaceholderAuth:
type: http type: http
@@ -421,14 +435,14 @@ components:
summary: General entry ticket summary: General entry ticket
value: value:
ticketType: general ticketType: general
ticketDate: 2023-09-07 ticketDate: '2023-09-07'
email: todd@example.com email: todd@example.com
BuyEventTicketsRequestExample: BuyEventTicketsRequestExample:
summary: Special event ticket summary: Special event ticket
value: value:
ticketType: general ticketType: general
eventId: dad4bce8-f5cb-4078-a211-995864315e39 eventId: dad4bce8-f5cb-4078-a211-995864315e39
ticketDate: 2023-09-05 ticketDate: '2023-09-05'
email: todd@example.com email: todd@example.com
BuyGeneralTicketsResponseExample: BuyGeneralTicketsResponseExample:
summary: General entry ticket summary: General entry ticket
@@ -436,7 +450,7 @@ components:
message: Museum general entry ticket purchased message: Museum general entry ticket purchased
ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a
ticketType: general ticketType: general
ticketDate: 2023-09-07 ticketDate: '2023-09-07'
confirmationCode: ticket-general-e5e5c6-dce78 confirmationCode: ticket-general-e5e5c6-dce78
BuyEventTicketsResponseExample: BuyEventTicketsResponseExample:
summary: Special event ticket summary: Special event ticket
@@ -445,7 +459,7 @@ components:
ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9 ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9
eventName: Mermaid Treasure Identification and Analysis eventName: Mermaid Treasure Identification and Analysis
ticketType: event ticketType: event
ticketDate: 2023-09-05 ticketDate: '2023-09-05'
confirmationCode: ticket-event-9c55eg-8v82a confirmationCode: ticket-event-9c55eg-8v82a
CreateSpecialEventRequestExample: CreateSpecialEventRequestExample:
summary: Create special event summary: Create special event
@@ -454,8 +468,8 @@ components:
location: Under the seaaa 🦀 🎶 🌊. location: Under the seaaa 🦀 🎶 🌊.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel. eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates: dates:
- 2023-09-05 - '2023-09-05'
- 2023-09-08 - '2023-09-08'
price: 0 price: 0
CreateSpecialEventResponseExample: CreateSpecialEventResponseExample:
summary: Special event created summary: Special event created
@@ -465,8 +479,8 @@ components:
location: Under the seaaa 🦀 🎶 🌊. location: Under the seaaa 🦀 🎶 🌊.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel. eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates: dates:
- 2023-09-05 - '2023-09-05'
- 2023-09-08 - '2023-09-08'
price: 30 price: 30
GetSpecialEventResponseExample: GetSpecialEventResponseExample:
summary: Get special event summary: Get special event
@@ -476,9 +490,9 @@ components:
location: Temporal Tearoom location: Temporal Tearoom
eventDescription: Sip tea with important historical figures. eventDescription: Sip tea with important historical figures.
dates: dates:
- 2023-11-18 - '2023-11-18'
- 2023-11-25 - '2023-11-25'
- 2023-12-02 - '2023-12-02'
price: 60 price: 60
ListSpecialEventsResponseExample: ListSpecialEventsResponseExample:
summary: List of special events summary: List of special events
@@ -488,85 +502,85 @@ components:
location: Seattle... probably location: Seattle... probably
eventDescription: They're big, they're hairy, but they're also graceful. Come learn how the biggest feet can have the lightest touch. eventDescription: They're big, they're hairy, but they're also graceful. Come learn how the biggest feet can have the lightest touch.
dates: dates:
- 2023-12-15 - '2023-12-15'
- 2023-12-22 - '2023-12-22'
price: 40 price: 40
- eventId: 2f14374a-9c65-4ee5-94b7-fba66d893483 - eventId: 2f14374a-9c65-4ee5-94b7-fba66d893483
name: Solar Telescope Demonstration name: Solar Telescope Demonstration
location: Far from the sun. location: Far from the sun.
eventDescription: Look at the sun without going blind! eventDescription: Look at the sun without going blind!
dates: dates:
- 2023-09-07 - '2023-09-07'
- 2023-09-14 - '2023-09-14'
price: 50 price: 50
- eventId: 6aaa61ba-b2aa-4868-b803-603dbbf7bfdb - eventId: 6aaa61ba-b2aa-4868-b803-603dbbf7bfdb
name: Cook like a Caveman name: Cook like a Caveman
location: Fire Pit on East side location: Fire Pit on East side
eventDescription: Learn to cook on an open flame. eventDescription: Learn to cook on an open flame.
dates: dates:
- 2023-11-10 - '2023-11-10'
- 2023-11-17 - '2023-11-17'
- 2023-11-24 - '2023-11-24'
price: 5 price: 5
- eventId: 602b75e1-5696-4ab8-8c7a-f9e13580f910 - eventId: 602b75e1-5696-4ab8-8c7a-f9e13580f910
name: Underwater Basket Weaving name: Underwater Basket Weaving
location: Rec Center Pool next door. location: Rec Center Pool next door.
eventDescription: Learn to weave baskets underwater. eventDescription: Learn to weave baskets underwater.
dates: dates:
- 2023-09-12 - '2023-09-12'
- 2023-09-15 - '2023-09-15'
price: 15 price: 15
- eventId: dad4bce8-f5cb-4078-a211-995864315e39 - eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis name: Mermaid Treasure Identification and Analysis
location: Room Sea-12 location: Room Sea-12
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits — kindly donated by Ariel. eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits — kindly donated by Ariel.
dates: dates:
- 2023-09-05 - '2023-09-05'
- 2023-09-08 - '2023-09-08'
price: 30 price: 30
- eventId: 6744a0da-4121-49cd-8479-f8cc20526495 - eventId: 6744a0da-4121-49cd-8479-f8cc20526495
name: Time Traveler Tea Party name: Time Traveler Tea Party
location: Temporal Tearoom location: Temporal Tearoom
eventDescription: Sip tea with important historical figures. eventDescription: Sip tea with important historical figures.
dates: dates:
- 2023-11-18 - '2023-11-18'
- 2023-11-25 - '2023-11-25'
- 2023-12-02 - '2023-12-02'
price: 60 price: 60
- eventId: 3be6453c-03eb-4357-ae5a-984a0e574a54 - eventId: 3be6453c-03eb-4357-ae5a-984a0e574a54
name: Pirate Coding Workshop name: Pirate Coding Workshop
location: Computer Room location: Computer Room
eventDescription: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang). eventDescription: Captain Blackbeard shares his love of the C...language. And possibly Arrrrr (R lang).
dates: dates:
- 2023-10-29 - '2023-10-29'
- 2023-10-30 - '2023-10-30'
- 2023-10-31 - '2023-10-31'
price: 45 price: 45
- eventId: 9d90d29a-2af5-4206-97d9-9ea9ceadcb78 - eventId: 9d90d29a-2af5-4206-97d9-9ea9ceadcb78
name: Llama Street Art Through the Ages name: Llama Street Art Through the Ages
location: Auditorium location: Auditorium
eventDescription: Llama street art?! Alpaca my bags -- let's go! eventDescription: Llama street art?! Alpaca my bags -- let's go!
dates: dates:
- 2023-10-29 - '2023-10-29'
- 2023-10-30 - '2023-10-30'
- 2023-10-31 - '2023-10-31'
price: 45 price: 45
- eventId: a3c7b2c4-b5fb-4ef7-9322-00a919864957 - eventId: a3c7b2c4-b5fb-4ef7-9322-00a919864957
name: The Great Parrot Debate name: The Great Parrot Debate
location: Outdoor Amphitheatre location: Outdoor Amphitheatre
eventDescription: See leading parrot minds discuss important geopolitical issues. eventDescription: See leading parrot minds discuss important geopolitical issues.
dates: dates:
- 2023-11-03 - '2023-11-03'
- 2023-11-10 - '2023-11-10'
price: 35 price: 35
- eventId: b92d46b7-4c5d-422b-87a5-287767e26f29 - eventId: b92d46b7-4c5d-422b-87a5-287767e26f29
name: Eat a Bunch of Corn name: Eat a Bunch of Corn
location: Cafeteria location: Cafeteria
eventDescription: We accidentally bought too much corn. Please come eat it. eventDescription: We accidentally bought too much corn. Please come eat it.
dates: dates:
- 2023-11-10 - '2023-11-10'
- 2023-11-17 - '2023-11-17'
- 2023-11-24 - '2023-11-24'
price: 5 price: 5
UpdateSpecialEventRequestExample: UpdateSpecialEventRequestExample:
summary: Update special event request summary: Update special event request
@@ -581,8 +595,8 @@ components:
location: On the beach. location: On the beach.
eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel. eventDescription: Join us as we review and classify a rare collection of 20 thingamabobs, gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates: dates:
- 2023-09-05 - '2023-09-05'
- 2023-09-08 - '2023-09-08'
price: 15 price: 15
GetMuseumHoursResponseExample: GetMuseumHoursResponseExample:
summary: Get hours response summary: Get hours response
@@ -621,7 +635,7 @@ components:
PaginationPage: PaginationPage:
name: page name: page
in: query in: query
description: The page number to retrieve. description: Page number to retrieve.
schema: schema:
type: integer type: integer
default: 1 default: 1
@@ -629,7 +643,7 @@ components:
PaginationLimit: PaginationLimit:
name: limit name: limit
in: query in: query
description: The number of days per page. description: Number of days per page.
schema: schema:
type: integer type: integer
default: 10 default: 10
@@ -638,7 +652,7 @@ components:
EventId: EventId:
name: eventId name: eventId
in: path in: path
description: An identifier for a special event. description: Identifier for a special event.
required: true required: true
schema: schema:
type: string type: string
@@ -647,33 +661,52 @@ components:
StartDate: StartDate:
name: startDate name: startDate
in: query in: query
description: The starting date to retrieve future operating hours from. Defaults to today's date. description: Starting date to retrieve future operating hours from. Defaults to today's date.
schema: schema:
type: string type: string
format: date format: date
example: 2023-02-23 example: '2023-02-23'
EndDate: EndDate:
name: endDate name: endDate
in: query in: query
description: The end of a date range to retrieve special events for. Defaults to 7 days after `startDate`. description: End of a date range to retrieve special events for. Defaults to 7 days after `startDate`.
schema: schema:
type: string type: string
format: date format: date
example: 2023-04-18 example: '2023-04-18'
TicketId: TicketId:
name: ticketId name: ticketId
in: path in: path
description: An identifier for a ticket to a museum event. Used to generate ticket image. description: Identifier for a ticket to a museum event. Used to generate ticket image.
required: true required: true
schema: schema:
type: string type: string
format: uuid format: uuid
example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
responses:
BadRequest:
description: Bad request.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: Not found.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized.
content:
application/problem+json:
schema:
$ref: '#/components/schemas/Error'
tags: tags:
- name: Operations - name: Operations
description: Operational information about the museum. description: Operational information about the museum.
- name: Events - name: Events
description: Special events hosted by the Museum description: Special events hosted by the museum.
- name: Tickets - name: Tickets
description: Museum tickets for general entrance or special events. description: Museum tickets for general entrance or special events.
security: security: