Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use 'OpenAPI link' to detect relations between entities #129

Open
ricfio opened this issue Dec 11, 2022 · 1 comment
Open

use 'OpenAPI link' to detect relations between entities #129

ricfio opened this issue Dec 11, 2022 · 1 comment

Comments

@ricfio
Copy link

ricfio commented Dec 11, 2022

Description
Why do you not use OpenAPI links to detect relations between entities instead of use the current conventions name based?

See:

## OpenAPI Support

In order to reference the resources between themselves (embeddeds or relations), the library guesses embeddeds or references from property names.
For instance if a book schema has a reviews property, the library tries to find a Review resource.
If there is, a relation or an embedded between Book and Review resources is made for the reviews field.
The property name can also be like review_id, reviewId, review_ids or reviewIds for references.

I'm discussing about this possibility on platformatic repository, here:
platformatic/platformatic#446

@alanpoulain
Copy link
Member

OpenAPI links is a new feature. Only a few schemas use it (API Platform does not).
But it can be an improvement: if links are used in the schema, do not guess the relations.
It should be an optional config parameter though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants