microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
2.93k stars 205 forks source link

Investigate how to provide component slicing on top of endpoints slicing #4488

Open sebastienlevert opened 6 months ago

sebastienlevert commented 6 months ago

As depicted in #4440, it would be useful to allow developers to define the specific properties from the referenced components. For instance, if I'm using the /users endpoint on Microsoft Graph, I should be able to say that I only care about the displayName and the id of the component. The rest will not be useful for my scenarios so I'd rather not have them. This will also limit the number of components retrieved and generated as models (no reference to them so they would become useless).

The big questions:

baywet commented 6 months ago

I think we could deliver this with a couple of restrictions:

  1. only works for components schema, not for inline schemas
  2. only allows you to trim properties of models (and associated models if they become "isolated" because of that), or entire models, not enum members, composed type member types, etc...
--whatever microsoft.graph.servicePrincipal --whatever microsoft.graph.user#memberOf

Would trim the service principal type, and any reference to it, as well as the memberOf property from user (and if we assume that property was the only reference to group, group would also be trimmed off)

We'd need to come up with a parameter name.

Now the question is: do we need any of that considering it requires some advanced understanding of kiota/OpenAPI and considering we're talking about overlays support which would allow you to do the exact same thing?