Skip to content

Commit 2717901

Browse files
committed
Update generator to yield more fields in input tables
1 parent ad4323b commit 2717901

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

src/plugins/connectors/index.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ handlebars.registerHelper("cleanDefaultForTable", (value: string) => {
1515
return value.replaceAll("\n", "<br />");
1616
});
1717

18+
handlebars.registerHelper("cleanModelForTable", (value: string) => {
19+
if (!value) return;
20+
const options = JSON.parse(JSON.parse(value)) as { label: string; value: string }[];
21+
return (
22+
"<ul>" +
23+
options
24+
.map(({ label, value }) =>
25+
label === value ? `<li>${label}</li>` : `<li>${label} (${value})</li>`,
26+
)
27+
.join("") +
28+
"</ul>"
29+
);
30+
});
31+
1832
handlebars.registerHelper("lowerCase", (value: string) => value.toLowerCase());
1933

2034
handlebars.registerPartial(
@@ -88,7 +102,7 @@ async function generateConnectorDocs({
88102
}
89103
}
90104

91-
fetchConnectorIcon(connector);
105+
if (!fromManifest) fetchConnectorIcon(connector);
92106
writeConnectorDocsFile(connector, connectorTemplate);
93107
}
94108
}

src/plugins/connectors/queries.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ const componentFragment = `
7171
key
7272
label
7373
type
74+
required
7475
default
7576
comments
77+
collection
78+
model
7679
}
7780
}
7881
}
@@ -91,6 +94,7 @@ const componentFragment = `
9194
label
9295
type
9396
collection
97+
model
9498
default
9599
comments
96100
required
@@ -115,6 +119,7 @@ const componentFragment = `
115119
label
116120
type
117121
collection
122+
model
118123
default
119124
comments
120125
required
@@ -139,6 +144,7 @@ const componentFragment = `
139144
label
140145
type
141146
collection
147+
model
142148
default
143149
comments
144150
required

src/plugins/connectors/templates/connector.md.hbs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,18 @@ Read about how OAuth 2.0 works [here](../oauth2.md).
6767
{{/each}} {{!-- actions.nodes --}}
6868

6969
{{/if}} {{!-- actions.nodes --}}
70+
71+
{{#if dataSources.nodes}}
72+
73+
## Data Sources
74+
75+
{{#each dataSources.nodes}}
76+
### {{{label}}}
77+
78+
{{{description}}}
79+
80+
{{>inputsTable inputs=inputs.nodes}}
81+
82+
{{/each}} {{!-- dataSources.nodes --}}
83+
84+
{{/if}} {{!-- dataSources.nodes --}}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{#if inputs }}
2-
| Input | Comments | Default |
3-
|---|---|--|
2+
| Input | Comments | Required? | Type | Default | Options |
3+
|---|---|--|---|---|---|
44
{{#each inputs}}
5-
| {{{label}}} | {{{comments}}} | {{{cleanDefaultForTable default}}} |
6-
{{/each}}
7-
{{/if}}
5+
| {{{label}}} | {{{comments}}} | {{{required}}} | {{{type}}} | {{{cleanDefaultForTable default}}} | {{{cleanModelForTable model}}} |
6+
{{/each}}
7+
{{/if}}

0 commit comments

Comments
 (0)