diff --git a/test/definitions/3.0.0/definitions.suite.mjs b/test/definitions/3.0.0/definitions.suite.mjs deleted file mode 100644 index b7f0fccf..00000000 --- a/test/definitions/3.0.0/definitions.suite.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import {describe} from 'vitest'; - -describe('AsyncAPI 3.0.0 Test Suite', async () => { - await import('./models/index.mjs'); -}) \ No newline at end of file diff --git a/test/definitions/3.0.0/models/index.mjs b/test/definitions/3.0.0/models/index.mjs deleted file mode 100644 index 1f3db2d9..00000000 --- a/test/definitions/3.0.0/models/index.mjs +++ /dev/null @@ -1,5 +0,0 @@ -import {describe} from 'vitest'; - -describe('Models Test Suite', async () => { - await import('./channel'); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/empty.json b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/extended.json b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/extended.json deleted file mode 100644 index b2fda85c..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/extended.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/index.mjs b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/index.mjs deleted file mode 100644 index fa1da080..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/index.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); - -describe('Authorization Code Flow', () => { - it('empty', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - )); - - it('without required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/only required properties.json b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/only required properties.json deleted file mode 100644 index bf77121b..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/only required properties.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/without required properties.json b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/without required properties.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/without required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/wrongly extended.json b/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/wrongly extended.json deleted file mode 100644 index 35be7e2f..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/authorizationCodeOAuthFlow/wrongly extended.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/empty.json b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/extended.json b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/extended.json deleted file mode 100644 index c4af4cf6..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/extended.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/index.mjs b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/index.mjs deleted file mode 100644 index 47ea221a..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/index.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); - -describe('Client Credentials Flow', () => { - it('empty', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - )); - - it('without required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/only required properties.json b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/only required properties.json deleted file mode 100644 index a5000c20..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/only required properties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/without required properties.json b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/without required properties.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/without required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/wrongly extended.json b/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/wrongly extended.json deleted file mode 100644 index 515c1db8..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/clientCredentialsOAuthFlow/wrongly extended.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/empty.json b/test/definitions/3.0.0/security/oauth2/flows/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/extended.json b/test/definitions/3.0.0/security/oauth2/flows/extended.json deleted file mode 100644 index f78a8f67..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/extended.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "type": "oauth2", - "description": "oauth2", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "clientCredentials": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "implicit": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "password": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - } - }, - "scopes": [ "write:pets", "read:pets" ], - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/empty.json b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/extended.json b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/extended.json deleted file mode 100644 index fe1b3046..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/extended.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/index.mjs b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/index.mjs deleted file mode 100644 index 9aa5458b..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/index.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); - -describe('Implicit Flow', () => { - it('empty', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - )); - - it('without required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/only required properties.json b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/only required properties.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/only required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/without required properties.json b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/without required properties.json deleted file mode 100644 index 0aec5271..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/without required properties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/wrongly extended.json b/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/wrongly extended.json deleted file mode 100644 index 0c521aa4..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/implicitOAuthFlow/wrongly extended.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/index.mjs b/test/definitions/3.0.0/security/oauth2/flows/index.mjs deleted file mode 100644 index 7e5a997d..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/index.mjs +++ /dev/null @@ -1,40 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/oauth2Flows.json'); - -describe('OAuth2 Flows', () => { - it('empty', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - [ - 'must have required property \'type\'', - 'must have required property \'flows\'' - ] - )); - - it('without required properties', () => TestHelper.objectIsNotValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - [ - 'must have required property \'type\'', - 'must have required property \'flows\'' - ] - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it.skip('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/only required properties.json b/test/definitions/3.0.0/security/oauth2/flows/only required properties.json deleted file mode 100644 index c9e5a3d2..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/only required properties.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "type": "oauth2", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "clientCredentials": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "implicit": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "password": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - } - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/empty.json b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/empty.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/empty.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/extended.json b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/extended.json deleted file mode 100644 index c4af4cf6..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/extended.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/index.mjs b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/index.mjs deleted file mode 100644 index d602d7a0..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/index.mjs +++ /dev/null @@ -1,32 +0,0 @@ -import {describe, it} from 'vitest'; -import TestHelper from '@test/test-helper'; -import path from 'path'; - -const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); - -describe('Password Flow', () => { - it('empty', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './empty.json'), - )); - - it('without required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './without required properties.json'), - )); - - it('only required properties', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './only required properties.json'), - )); - - it('extended', () => TestHelper.objectIsValid( - jsonSchema, - path.resolve(__dirname, './extended.json'), - )); - - it('wrongly extended', () => TestHelper.wronglyExtended( - jsonSchema, - path.resolve(__dirname, './wrongly extended.json'), - )); -}); diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/only required properties.json b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/only required properties.json deleted file mode 100644 index 0967ef42..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/only required properties.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/without required properties.json b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/without required properties.json deleted file mode 100644 index a5000c20..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/without required properties.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/wrongly extended.json b/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/wrongly extended.json deleted file mode 100644 index 515c1db8..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/passwordOAuthFlow/wrongly extended.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - }, - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/without required properties.json b/test/definitions/3.0.0/security/oauth2/flows/without required properties.json deleted file mode 100644 index 2c824fb8..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/without required properties.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "description": "oauth2", - "scopes": [ "write:pets", "read:pets" ] -} diff --git a/test/definitions/3.0.0/security/oauth2/flows/wrongly extended.json b/test/definitions/3.0.0/security/oauth2/flows/wrongly extended.json deleted file mode 100644 index 9dc55a0e..00000000 --- a/test/definitions/3.0.0/security/oauth2/flows/wrongly extended.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "type": "oauth2", - "description": "oauth2", - "flows": { - "authorizationCode": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "clientCredentials": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "implicit": { - "authorizationUrl": "https://example.com/api/oauth/dialog", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - }, - "password": { - "tokenUrl": "https://example.com/api/oauth/token", - "refreshUrl": "https://example.com/api/oauth/refresh", - "availableScopes": { - "write:pets": "modify pets in your account", - "read:pets": "read your pets" - } - } - }, - "scopes": [ "write:pets", "read:pets" ], - "x-number": 0, - "x-string": "", - "x-object": { - "property": {} - }, - "ext-number": 1 -} diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs new file mode 100644 index 00000000..0096f0fb --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 authorization code flow.test.mjs @@ -0,0 +1,51 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Authorization Code Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs new file mode 100644 index 00000000..7c021d3f --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 client credentials flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Client Credentials Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs new file mode 100644 index 00000000..08c11acd --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 flows.test.mjs @@ -0,0 +1,147 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flows.json'); + +const config = new JsonSchemaTestSuiteConfig( + true, + [ + 'must have required property \'type\'', + 'must have required property \'flows\'' + ], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "type": "oauth2", + "description": "oauth2", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "clientCredentials": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "scopes": [ "write:pets", "read:pets" ] + } + ], + { + "type": "oauth2", + "flows": { + "authorizationCode": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "clientCredentials": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "implicit": { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + }, + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + } + }, + { + "description": "oauth2", + "scopes": [ "write:pets", "read:pets" ] + }, + { + "type": "oauth2", + "flows":{ + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "type": "oauth2", + "flows":{ + "password": { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + }, + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Flows', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs new file mode 100644 index 00000000..f7150785 --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 implicit flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "authorizationUrl": "https://example.com/api/oauth/dialog", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Implicit Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs new file mode 100644 index 00000000..ac363998 --- /dev/null +++ b/test/definitions/3.0.0/security/oauth2/oauth2 password flow.test.mjs @@ -0,0 +1,50 @@ +import { + JsonSchemaTestSuite, + JsonSchemaTestSuiteConfig, + JsonSchemaTestSuiteData +} from '@test/definitions/base-schema-test.mjs'; +import {describe} from 'vitest'; + +const jsonSchema = require('@definitions/3.0.0/oauth2Flow.json'); + +const config = new JsonSchemaTestSuiteConfig( + false, + [], + true, + [] +); + +const data = new JsonSchemaTestSuiteData( + jsonSchema, + [ + { + "tokenUrl": "https://example.com/api/oauth/token", + "refreshUrl": "https://example.com/api/oauth/refresh", + "availableScopes": { + "write:pets": "modify pets in your account", + "read:pets": "read your pets" + } + } + ], + {}, + {}, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + } + }, + { + "x-number": 0, + "x-string": "", + "x-object": { + "property": {} + }, + "ext-number": 1 + } +); + +describe('OAuth2 Password Flow', () => { + new JsonSchemaTestSuite(data, config).testSuite() +}); diff --git a/test/definitions/3.0.0/security/oauth2/oauth2.test.mjs b/test/definitions/3.0.0/security/oauth2/oauth2.test.mjs deleted file mode 100644 index 5072950f..00000000 --- a/test/definitions/3.0.0/security/oauth2/oauth2.test.mjs +++ /dev/null @@ -1,9 +0,0 @@ -import {describe} from 'vitest'; - -describe('OAuth2 Test Suite', async () => { - await import('./flows'); - await import('./flows/implicitOAuthFlow'); - await import('./flows/passwordOAuthFlow'); - await import('./flows/authorizationCodeOAuthFlow'); - await import('./flows/clientCredentialsOAuthFlow'); -});