Skip to content

Commit

Permalink
fix(facade): error in processing nested objects
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Aug 29, 2024
1 parent a5cd9c6 commit 9fef5ec
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/facade/src/gql/protos/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,14 @@ export const preProcessGQLInput = async (
};
} else {
const fields = model.getFields();
const converted = await Promise.all(
await Promise.all(
Object.keys(fields).filter(
key => key in data
).map(
key => preProcessGQLInput(data[key], fields[key].type)
async key => data[key] = await preProcessGQLInput(data[key], fields[key].type)
)
);
return {
...data,
...converted,
};
return data;
}
}

Expand Down Expand Up @@ -106,10 +103,9 @@ export const postProcessGQLOutput = (data: any, model: GraphQLOutputType): any =
}

if (model instanceof GraphQLObjectType) {
if (model.name === 'GoogleProtobufAny' && data.value) {
if (model.name === 'GoogleProtobufAny') {
// TODO Use encoded once resource base supports it

const decoded = JSON.parse((data.value as Buffer).toString());
const decoded = JSON.parse(data?.value?.toString());

return {
...data,
Expand Down

0 comments on commit 9fef5ec

Please sign in to comment.