Skip to content

Commit 42decf6

Browse files
committed
feat: add json schema validation to the GH API responses
1 parent d23033b commit 42decf6

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/workflows/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { simplifyObject } = require('@ulisesgascon/simplify-object')
33
const { github } = require('../providers')
44
const { initializeStore } = require('../store')
55
const { logger } = require('../utils')
6+
const { validateGithubOrg } = require('../schemas')
67

78
const mapOrgData = (data) => {
89
const mappedData = simplifyObject(data, {
@@ -47,6 +48,8 @@ const updateGithubOrgs = async (knex) => {
4748
await Promise.all(organizations.map(async (org) => {
4849
debug(`Fetching details for org (${org.login})`)
4950
const data = await github.fetchOrgByLogin(org.login)
51+
debug('Validating data')
52+
validateGithubOrg(data)
5053
debug('Transforming data')
5154
const mappedData = mapOrgData(data)
5255
debug('Updating organization in database')

0 commit comments

Comments
 (0)