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
@@ -55,96 +56,19 @@ The connector can automatically transform OpenAPI 2.0 and 3.0 definitions to NDC
55
56
| OAuth 2.0 | ✅ | Built-in support for the `client_credentials` grant. Other grant types require forwarding access tokens from headers by the Hasura engine |
56
57
| mTLS | ✅ ||
57
58
58
-
## Quick start
59
+
## Get Started
59
60
60
-
Start the connector server at http://localhost:8080 using the [JSON Placeholder](https://jsonplaceholder.typicode.com/) APIs.
61
-
62
-
```go
63
-
go run ./server serve --configuration ./connector/testdata/jsonplaceholder
64
-
```
61
+
Follow the [Quick Start Guide](https://hasura.io/docs/3.0/getting-started/overview/) in Hasura DDN docs. At the `Connect to data` step, choose the `hasura/http` data connector from the dropdown. The connector template includes an example that is ready to run.
-[Recipes](https://github.com/hasura/ndc-http-recipes/tree/main): You can find or request pre-built configuration recipes of popular API services here.
73
-
74
-
## Configuration
75
-
76
-
The connector reads `config.{json,yaml}` file in the configuration folder. The file contains information about the schema file path and its specification:
77
-
78
-
```yaml
79
-
files:
80
-
- file: swagger.json
81
-
spec: openapi2
82
-
- file: openapi.yaml
83
-
spec: openapi3
84
-
trimPrefix: /v1
85
-
envPrefix: PET_STORE
86
-
- file: schema.json
87
-
spec: ndc
88
-
```
89
-
90
-
The config of each element follows the [config schema](https://github.com/hasura/ndc-http/ndc-http-schema/blob/main/config.example.yaml) of `ndc-http-schema`.
91
-
92
-
You can add many API documentation files into the same connector.
93
-
94
-
> [!IMPORTANT]
95
-
> Conflicted object and scalar types will be ignored. Only the type of the first file is kept in the schema.
96
-
97
-
### Supported specs
98
-
99
-
#### OpenAPI
100
-
101
-
HTTP connector supports both OpenAPI 2 and 3 specifications.
102
-
103
-
- `oas3`/`openapi3`: OpenAPI 3.0/3.1.
104
-
- `oas2`/`openapi2`: OpenAPI 2.0.
105
-
106
-
#### HTTP Connector schema
107
-
108
-
Enum: `ndc`
109
-
110
-
HTTP schema is the native configuration schema which other specs will be converted to behind the scene. The schema extends the NDC Specification with HTTP configuration and can be converted from other specs by the [NDC HTTP schema CLI](./ndc-http-schema).
111
-
112
-
### Timeout and retry
113
-
114
-
The global timeout and retry strategy can be configured in each file:
115
-
116
-
```yaml
117
-
files:
118
-
- file: swagger.json
119
-
spec: oas2
120
-
timeout:
121
-
value: 30
122
-
retry:
123
-
times:
124
-
value: 1
125
-
delay:
126
-
# delay between each retry in milliseconds
127
-
value: 500
128
-
httpStatus: [429, 500, 502, 503]
129
-
```
130
-
131
-
### JSON Patch
132
-
133
-
You can add JSON patches to extend API documentation files. HTTP connector supports `merge` and `json6902` strategies. JSON patches can be applied before or after the conversion from OpenAPI to HTTP schema configuration. It will be useful if you need to extend or fix some fields in the API documentation such as server URL.
134
-
135
-
```yaml
136
-
files:
137
-
- file: openapi.yaml
138
-
spec: oas3
139
-
patchBefore:
140
-
- path: patch-before.yaml
141
-
strategy: merge
142
-
patchAfter:
143
-
- path: patch-after.yaml
144
-
strategy: json6902
145
-
```
146
-
147
-
See [the example](./ndc-http-schema/command/testdata/patch) for more context.
0 commit comments