diff --git a/src/connector-cli/resources/schemas/authentication-types/chili-token.json b/src/connector-cli/resources/schemas/authentication-types/chili-token.json index bcf5179..c6ca506 100644 --- a/src/connector-cli/resources/schemas/authentication-types/chili-token.json +++ b/src/connector-cli/resources/schemas/authentication-types/chili-token.json @@ -6,6 +6,5 @@ "type": "string" } }, - "required": ["name"], "additionalProperties": false } diff --git a/src/connector-cli/resources/schemas/authentication-types/oauth2-authorization-code.json b/src/connector-cli/resources/schemas/authentication-types/oauth2-authorization-code.json index 140a836..62cff88 100644 --- a/src/connector-cli/resources/schemas/authentication-types/oauth2-authorization-code.json +++ b/src/connector-cli/resources/schemas/authentication-types/oauth2-authorization-code.json @@ -60,11 +60,6 @@ "$ref": "#/$defs/SpecCustomization" } }, - "required": [ - "name", - "clientId", - "clientSecret", - "authorizationServerMetadata" - ], + "required": ["clientId", "clientSecret", "authorizationServerMetadata"], "additionalProperties": false } diff --git a/src/connector-cli/resources/schemas/authentication-types/oauth2-client-credentials.json b/src/connector-cli/resources/schemas/authentication-types/oauth2-client-credentials.json index 2ad12c8..04f25f2 100644 --- a/src/connector-cli/resources/schemas/authentication-types/oauth2-client-credentials.json +++ b/src/connector-cli/resources/schemas/authentication-types/oauth2-client-credentials.json @@ -18,6 +18,6 @@ "type": "string" } }, - "required": ["name", "clientId", "clientSecret", "tokenEndpoint"], + "required": ["clientId", "clientSecret", "tokenEndpoint"], "additionalProperties": false } diff --git a/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json b/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json index bfc5abd..2578167 100644 --- a/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json +++ b/src/connector-cli/resources/schemas/authentication-types/oauth2-resource-owner-password.json @@ -30,7 +30,6 @@ } }, "required": [ - "name", "clientId", "clientSecret", "tokenEndpoint", diff --git a/src/connector-cli/resources/schemas/authentication-types/static-key.json b/src/connector-cli/resources/schemas/authentication-types/static-key.json index 59ae064..31663c4 100644 --- a/src/connector-cli/resources/schemas/authentication-types/static-key.json +++ b/src/connector-cli/resources/schemas/authentication-types/static-key.json @@ -12,6 +12,6 @@ "type": "string" } }, - "required": ["name", "key", "value"], + "required": ["key", "value"], "additionalProperties": false } diff --git a/src/connector-cli/src/commands/set-auth/index.ts b/src/connector-cli/src/commands/set-auth/index.ts index 751d8ec..c3cc510 100644 --- a/src/connector-cli/src/commands/set-auth/index.ts +++ b/src/connector-cli/src/commands/set-auth/index.ts @@ -43,7 +43,7 @@ export async function runSetAuth( if (connectorConfig.supportedAuth.length === 0) { throw new ExecutionError( - 'There is no information about supported authentication for this connector. Specify "config.supportedAuth" in connecotr\'s package.json' + 'There is no information about supported authentication for this connector. Specify "config.supportedAuth" in connector\'s package.json' ); } @@ -64,6 +64,10 @@ export async function runSetAuth( token: accessToken, }); + if (!authData.name) { + authData.name = `${id}-${usage}-${type}`; + } + info('Build full request URL...'); const requestUrl = getRequestUrl(baseUrl, environment, id, type); diff --git a/src/connector-cli/src/core/types/gen-types.ts b/src/connector-cli/src/core/types/gen-types.ts index 0980f62..6576160 100644 --- a/src/connector-cli/src/core/types/gen-types.ts +++ b/src/connector-cli/src/core/types/gen-types.ts @@ -13,14 +13,14 @@ // match the expected interface, even if the JSON is valid. export interface ChiliToken { - name: string; + name?: string; } export interface Oauth2AuthorizationCode { authorizationServerMetadata: AuthorizationServerMetadata; clientId: string; clientSecret: string; - name: string; + name?: string; scope?: string; specCustomization?: SpecCustomization; } @@ -49,7 +49,7 @@ export enum RequestContentType { export interface Oauth2ClientCredentials { clientId: string; clientSecret: string; - name: string; + name?: string; scope?: string; tokenEndpoint: string; } @@ -58,7 +58,7 @@ export interface Oauth2ResourceOwnerPassword { bodyFormat?: RequestContentType; clientId: string; clientSecret: string; - name: string; + name?: string; password: string; scope?: string; tokenEndpoint: string; @@ -67,7 +67,7 @@ export interface Oauth2ResourceOwnerPassword { export interface StaticKey { key: string; - name: string; + name?: string; value: string; } @@ -298,13 +298,13 @@ function r(name: string) { const typeMap: any = { "ChiliToken": o([ - { json: "name", js: "name", typ: "" }, + { json: "name", js: "name", typ: u(undefined, "") }, ], false), "Oauth2AuthorizationCode": o([ { json: "authorizationServerMetadata", js: "authorizationServerMetadata", typ: r("AuthorizationServerMetadata") }, { json: "clientId", js: "clientId", typ: "" }, { json: "clientSecret", js: "clientSecret", typ: "" }, - { json: "name", js: "name", typ: "" }, + { json: "name", js: "name", typ: u(undefined, "") }, { json: "scope", js: "scope", typ: u(undefined, "") }, { json: "specCustomization", js: "specCustomization", typ: u(undefined, r("SpecCustomization")) }, ], false), @@ -320,7 +320,7 @@ const typeMap: any = { "Oauth2ClientCredentials": o([ { json: "clientId", js: "clientId", typ: "" }, { json: "clientSecret", js: "clientSecret", typ: "" }, - { json: "name", js: "name", typ: "" }, + { json: "name", js: "name", typ: u(undefined, "") }, { json: "scope", js: "scope", typ: u(undefined, "") }, { json: "tokenEndpoint", js: "tokenEndpoint", typ: "" }, ], false), @@ -328,7 +328,7 @@ const typeMap: any = { { json: "bodyFormat", js: "bodyFormat", typ: u(undefined, r("RequestContentType")) }, { json: "clientId", js: "clientId", typ: "" }, { json: "clientSecret", js: "clientSecret", typ: "" }, - { json: "name", js: "name", typ: "" }, + { json: "name", js: "name", typ: u(undefined, "") }, { json: "password", js: "password", typ: "" }, { json: "scope", js: "scope", typ: u(undefined, "") }, { json: "tokenEndpoint", js: "tokenEndpoint", typ: "" }, @@ -336,7 +336,7 @@ const typeMap: any = { ], false), "StaticKey": o([ { json: "key", js: "key", typ: "" }, - { json: "name", js: "name", typ: "" }, + { json: "name", js: "name", typ: u(undefined, "") }, { json: "value", js: "value", typ: "" }, ], false), "ConnectorConfig": o([