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
parseGraphQl("https://demo.api-platform.com/graphql").then(({ api }) =>
69
+
console.log(api),
70
+
);
55
71
```
56
72
57
73
## OpenAPI Support
58
74
59
75
In order to support OpenAPI, the library makes some assumptions about how the documentation relates to a corresponding ressource:
76
+
60
77
- The path to get (`GET`) or edit (`PUT`) one resource looks like `/books/{id}` (regular expression used: `^[^{}]+/{[^{}]+}/?$`).
61
-
Note that `books` may be a singular noun (`book`).
62
-
If there is no path like this, the library skips the resource.
78
+
Note that `books` may be a singular noun (`book`).
79
+
If there is no path like this, the library skips the resource.
63
80
- The corresponding path schema is retrieved for `get` either in the [`response` / `200` / `content` / `application/json`] path section or in the `components` section of the documentation.
64
-
If retrieved from the `components` section, the component name needs to look like `Book` (singular noun).
65
-
For `put`, the schema is only retrieved in the [`requestBody` / `content` / `application/json`] path section.
66
-
If no schema is found, the resource is skipped.
81
+
If retrieved from the `components` section, the component name needs to look like `Book` (singular noun).
82
+
For `put`, the schema is only retrieved in the [`requestBody` / `content` / `application/json`] path section.
83
+
If no schema is found, the resource is skipped.
67
84
- If there are two schemas (one for `get` and one for `put`), resource fields are merged.
68
85
- The library looks for a creation (`POST`) and list (`GET`) path. They need to look like `/books` (plural noun).
69
86
- The deletion (`DELETE`) path needs to be inside the get / edit path.
70
87
- In order to reference the resources between themselves (embeddeds or relations), the library guesses embeddeds or references from property names.
71
-
For instance if a book schema has a `reviews` property, the library tries to find a `Review` resource.
72
-
If there is, a relation or an embedded between `Book` and `Review` resources is made for the `reviews` field.
73
-
The property name can also be like `review_id`, `reviewId`, `review_ids` or `reviewIds` for references.
88
+
For instance if a book schema has a `reviews` property, the library tries to find a `Review` resource.
89
+
If there is, a relation or an embedded between `Book` and `Review` resources is made for the `reviews` field.
90
+
The property name can also be like `review_id`, `reviewId`, `review_ids` or `reviewIds` for references.
0 commit comments