yii2-openapi icon indicating copy to clipboard operation
yii2-openapi copied to clipboard

Composite PK support

Open razvanphp opened this issue 3 years ago • 2 comments

Hey @cebe, thank you for this great library.

We started using the generator and want to develop the missing features and push some PRs.

Can you please point us in the right direction with this? What/where to look for PK array definition, we saw some comments in the code and assumed this implementation is trickier since it was left out ob purpose, but still, we need it and want to contribute.

Cheers, R

razvanphp avatar Nov 16 '22 21:11 razvanphp

Hi @razvanphp,

thanks for offering your help. I think we did not implement it because it was not needed. We can add it if we find good use cases for composite PK. However we are trying to follow the JSON API Standard as much as possible and it does not seem to define how to handle composite PKs, at least I did not find it. https://jsonapi.org/format/#document-resource-object-identification

How would your OpenAPI description, which defines an entity with composite PK look like and how should the API Requests/Responses handle the composite PK?

cebe avatar Nov 17 '22 09:11 cebe

Related to #135 if you want to define a composite PK for the database only, that should definitively be possible even though we have no way to express this relation at the API itself.

@razvanphp could you please share some details about your use case?

cebe avatar Jan 27 '23 12:01 cebe