Skip to content

Commit

Permalink
chore: make "name" as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
psamusev committed Sep 25, 2024
1 parent 6f2a7d6 commit 70ea167
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
"type": "string"
}
},
"required": ["name"],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@
"$ref": "#/$defs/SpecCustomization"
}
},
"required": [
"name",
"clientId",
"clientSecret",
"authorizationServerMetadata"
],
"required": ["clientId", "clientSecret", "authorizationServerMetadata"],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"type": "string"
}
},
"required": ["name", "clientId", "clientSecret", "tokenEndpoint"],
"required": ["clientId", "clientSecret", "tokenEndpoint"],
"additionalProperties": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
}
},
"required": [
"name",
"clientId",
"clientSecret",
"tokenEndpoint",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"type": "string"
}
},
"required": ["name", "key", "value"],
"required": ["key", "value"],
"additionalProperties": false
}
6 changes: 5 additions & 1 deletion src/connector-cli/src/commands/set-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
}

Expand All @@ -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);

Expand Down
20 changes: 10 additions & 10 deletions src/connector-cli/src/core/types/gen-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -49,7 +49,7 @@ export enum RequestContentType {
export interface Oauth2ClientCredentials {
clientId: string;
clientSecret: string;
name: string;
name?: string;
scope?: string;
tokenEndpoint: string;
}
Expand All @@ -58,7 +58,7 @@ export interface Oauth2ResourceOwnerPassword {
bodyFormat?: RequestContentType;
clientId: string;
clientSecret: string;
name: string;
name?: string;
password: string;
scope?: string;
tokenEndpoint: string;
Expand All @@ -67,7 +67,7 @@ export interface Oauth2ResourceOwnerPassword {

export interface StaticKey {
key: string;
name: string;
name?: string;
value: string;
}

Expand Down Expand Up @@ -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),
Expand All @@ -320,23 +320,23 @@ 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),
"Oauth2ResourceOwnerPassword": o([
{ 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: "" },
{ json: "username", js: "username", typ: "" },
], 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([
Expand Down

0 comments on commit 70ea167

Please sign in to comment.