Skip to content

Commit

Permalink
Get all connectors to show up in oas spec (#279)
Browse files Browse the repository at this point in the history
* separate files

* Got all connectors working including yodlee
  • Loading branch information
openint-bot authored Feb 25, 2025
1 parent 90577d1 commit 632ec01
Show file tree
Hide file tree
Showing 5 changed files with 8,944 additions and 202 deletions.
19 changes: 14 additions & 5 deletions connectors/connector-yodlee/YodleeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ export const zCreds = z.discriminatedUnion('role', [

/** Yodlee comma-delimited ids */
type YodleeIds = z.input<typeof zYodleeIds>
export const zYodleeId = z
.union([z.number(), z.string()])
.transform((id) => (typeof id === 'string' ? Number.parseInt(id) : id))
.openapi({refType: 'input'}) // @see https://github.com/samchungy/zod-openapi#zod-effects
export const zYodleeId = z.union([z.number(), z.string()])
// cannot use transform for now because .openapi() does not work due to differing zod versions
// .transform((id) => (typeof id === 'string' ? Number.parseInt(id) : id))
// .openapi({refType: 'input'}) // @see https://github.com/samchungy/zod-openapi#zod-effects
// Ideally when converting we should default to always refType input... Or basically
// allow the zodToOas31Schema to control this instead.
const zYodleeIds = z.union([zYodleeId, z.array(zYodleeId)])
Expand Down Expand Up @@ -157,7 +157,16 @@ export const makeYodleeClient = zFunction([zConfig, zCreds], (cfg, creds) => {

const getProvider = zFunction(zYodleeId, async (providerId) =>
api
.GET('/providers/{providerId}', {params: {path: {providerId}}})
.GET('/providers/{providerId}', {
params: {
path: {
providerId:
typeof providerId === 'string'
? Number.parseInt(providerId)
: providerId,
},
},
})
.then((r) => {
if (!r.data?.provider?.[0]) {
throw new YodleeNotFoundError({
Expand Down
Loading

0 comments on commit 632ec01

Please sign in to comment.