Using schemas to shape data in a BFF

Question if this is something Schema would help with: I'm writing a bff to learn a bit about effect - and part of the benefit to a BFF is that you can massage the data into a way that fits your frontend.

I was thinking that if someone was to use this bff, they would maybe want their data shaped how they want it, not necessarily how I write it. So I was curious - I could write it so a user could extend the interfaces so that the data would massage to the shape they ask it to be.

So if i had data like

{  transactionId: string; data: [{ inputs: [...], outputs: [...] ] }


Someone could extend the the interface to say I want to return

{
  data: []
}


I'm curious if this would be something that schema would help with at all? Could I leverage schemas to "detect" the interface i've received from a response, then massage it into a custom style?

May be a very dumb question, i'm still wrapping my head around schemas
Was this page helpful?