You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bad english here, TL;DR: Is their some plan for supporting 1:n relationships in openapi-to-graphql in the futur ?
In regard of this part of the documentation
To create nested object types for arrays, you will need to keep the following in mind.
Continuing from the previous example, let's say that there is a third operation called GET /friends/{userId} which would return an array of users, specifically the friends of a particular user. Furthermore, let's say you wanted to run the following query, which would allow you to get all the employers of Alan's friends:
If this was like the previous case, you would simply define a link from GET /friends/{userId} to GET /employers/{employerId}. However, this is impossible because of the current specification. This is because this operation returns an array rather than an object and the current specification does not provide a way to access individual elements of an array.
Nevertheless, OpenAPI-to-GraphQL can still create a nested relationship. This is because OpenAPI-to-GraphQL reuses object types. If GET /friends/{userId} returns an array of User object types, then each of those users will take on the links defined in other operations that return User object types. In other words, because GET /friends/{userId} returns an array of User object types and GET /users/{userId}, which also returns a User object type, has a link to GET /employers/{employerId}, you will still be able to get all the employers of a user's friends because of the shared type.
Am I right here ? If no, can you please point me to a solution reference ?
Is their some plan for supporting this in openapi-to-graphql in the futur ?
Would it be a good approch to use an OAS extention object to define these relationships to openapi-to-graphql ? This extention (like a x-Links property on the OAS response object) would be like the OAS Link object, but it would use JSON Path (or another way) to parse the parameters values over JSON Pointer ?
Or would it be a better approch to add an extention object at the Schema object level to express those relationships?
Best regards,
The text was updated successfully, but these errors were encountered:
Hello there .
Thank you for the awesome work here !
Bad english here, TL;DR: Is their some plan for supporting 1:n relationships in
openapi-to-graphql
in the futur ?In regard of this part of the documentation
I understand that because of OAI/OpenAPI-Specification#1327 and OAI/OpenAPI-Specification#1305, we cannot resolve 1:n nested relationships (with OAS Link object) in
openapi-to-graphql
.Am I right here ? If no, can you please point me to a solution reference ?
Is their some plan for supporting this in
openapi-to-graphql
in the futur ?Would it be a good approch to use an OAS extention object to define these relationships to openapi-to-graphql ? This extention (like a
x-Links
property on the OAS response object) would be like the OAS Link object, but it would use JSON Path (or another way) to parse the parameters values over JSON Pointer ?Or would it be a better approch to add an extention object at the Schema object level to express those relationships?
Best regards,
The text was updated successfully, but these errors were encountered: