Skip to content

Commit bd52432

Browse files
committed
fix http method, improve docs
1 parent 257af81 commit bd52432

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<a href='https://coveralls.io/github/StarpTech/graphql-registry?branch=main'><img src='https://coveralls.io/repos/github/StarpTech/graphql-registry/badge.svg?branch=main' alt='Coverage Status' /></a>
1515
</div>
1616

17-
<div align="center">GraphQL registry</div>
18-
1917
<br/>
2018

2119
> There should be a **single source of truth** for registering and tracking the graph.
@@ -112,7 +110,7 @@ POST - `/schema/diff` Returns the schema report of all services and the provided
112110
{
113111
"graph_name": "my_graph",
114112
"type_defs": "type Query { hello: String }",
115-
"name": "foo"
113+
"service_name": "foo"
116114
}
117115
```
118116

@@ -131,7 +129,7 @@ POST - `/schema/validate` Validate schema between provided and latest schemas.
131129
{
132130
"graph_name": "my_graph",
133131
"type_defs": "type Query { hello: String }",
134-
"name": "foo"
132+
"service_name": "foo"
135133
}
136134
```
137135

@@ -189,6 +187,11 @@ npm run dev
189187
npm run test
190188
```
191189

190+
### Insomnia collection
191+
192+
[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=GraphQL%20Registry&uri=https%3A%2F%2Fraw.githubusercontent.com%2FStarpTech%2Fgraphql-registry%2Fmain%2Finsomnia.json)
193+
194+
192195
### Benchmark
193196

194197
Run a benchmark with:

insomnia.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"_type":"export","__export_format":4,"__export_date":"2021-05-07T16:40:24.404Z","__export_source":"insomnia.desktop.app:v2021.3.0","resources":[{"_id":"req_ae07bb97e41c45488fe4e098e9fcd392","parentId":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","modified":1620405396761,"created":1620404658927,"url":"{{ _.baseUrl }}/schema/push","name":"Register Schema","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n \"type_defs\": \"type Query { hello: String }\",\n \"version\": \"1\",\n \"graph_name\": \"my_graph\",\n \"service_name\": \"foo\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_cae5a5a7c1df4fbbb5f95747ac6de78d"}],"authentication":{},"metaSortKey":400,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620405269116,"created":1620405194749,"name":"Federation","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":0,"_type":"request_group"},{"_id":"wrk_c5b177f049bf44f7aefeb315af5594bd","parentId":null,"modified":1620404599265,"created":1620404599265,"name":"Insomnia","description":"","scope":"collection","_type":"workspace"},{"_id":"req_336ebdc5fba642858d5d978700e65df1","parentId":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","modified":1620405391499,"created":1620404757674,"url":"{{ _.baseUrl }}/schema/compose","name":"Get latest schemas by versions","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n \"graph_name\": \"my_graph\",\n \"services\": [{ \"name\": \"foo\", \"version\": \"1\" }]\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_aa776b984d75400d8e53ab6412dc8ae5"}],"authentication":{},"metaSortKey":300,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_f5c560be99cf4216a9d6ae0cf7edb858","parentId":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","modified":1620405383905,"created":1620404802379,"url":"{{ _.baseUrl }}/schema/deactivate","name":"Deactivate a schema","description":"","method":"PUT","body":{"mimeType":"application/json","text":"{\n \"schemaId\": \"916348424\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_54598bee89b9433ea71b152980c68562"}],"authentication":{},"metaSortKey":0,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_26b0c1787982455ab1a8486a57182db8","parentId":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","modified":1620405355948,"created":1620405132600,"url":"{{ _.baseUrl }}/graphs","name":"Get all Graphs","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":100,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_3cd0a6406eca4f2d8d0103c32212c506","parentId":"fld_cb00a6e13e6840f4b4e1a0c5c2f63f82","modified":1620405345639,"created":1620405164443,"url":"{{ _.baseUrl }}/schema/latest?graph_name=my_graph","name":"Get latest schemas","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":200,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_ad711a8ef50b4143a7a624684ab711bd","parentId":"fld_ee0c7779dcc54e09ab1a0f1715909023","modified":1620405411075,"created":1620404900201,"url":"{{ _.baseUrl }}/schema/diff","name":"Produce a diff from your schema","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n \"graph_name\": \"my_graph\",\n \"type_defs\": \"type Query { hello: String }\",\n \"service_name\": \"foo\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_83fe9b94608343838cd283d0c2784105"}],"authentication":{},"metaSortKey":0,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_ee0c7779dcc54e09ab1a0f1715909023","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620405269116,"created":1620405215454,"name":"Validation","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":200,"_type":"request_group"},{"_id":"req_bcab07d7f22c4321b89380f4e0c5a26e","parentId":"fld_ee0c7779dcc54e09ab1a0f1715909023","modified":1620405415449,"created":1620405020069,"url":"{{ _.baseUrl }}/schema/diff","name":"Validate your schema","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n \"graph_name\": \"my_graph\",\n \"type_defs\": \"type Query { hello: String }\",\n \"service_name\": \"foo\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_b58858e1c31c4765ac9d9226bcbc8592"}],"authentication":{},"metaSortKey":100,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_627080f299434b4ca2ab995cc688c367","parentId":"fld_12e49a858e304effbd88e3809391438c","modified":1620405406670,"created":1620405064146,"url":"{{ _.baseUrl }}/schema/garbage_collect","name":"Remove all schemas except the most (N) recent","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n \"num_schemas_keep\": 10\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_4b3a277d831748888d0d4aeb8178cc7f"}],"authentication":{},"metaSortKey":100,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_12e49a858e304effbd88e3809391438c","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620405269116,"created":1620405250707,"name":"Maintainance","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":100,"_type":"request_group"},{"_id":"req_90a4b689d5d94521be8dcf99c2d010a1","parentId":"fld_12e49a858e304effbd88e3809391438c","modified":1620405402062,"created":1620405098480,"url":"{{ _.baseUrl }}/health","name":"Health","description":"","method":"GET","body":{},"parameters":[],"headers":[],"authentication":{},"metaSortKey":0,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_8e8bb9d79ca63367faee7a2d56149069e14cc521","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620405374019,"created":1620404599292,"name":"Base Environment","data":{"baseUrl":"http://127.0.0.1:3000"},"dataPropertyOrder":{"&":["baseUrl"]},"color":null,"isPrivate":false,"metaSortKey":1620404599292,"_type":"environment"},{"_id":"jar_8e8bb9d79ca63367faee7a2d56149069e14cc521","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620404599294,"created":1620404599294,"name":"Default Jar","cookies":[],"_type":"cookie_jar"},{"_id":"spc_8abc133306f14e4da7b7feff11c83a08","parentId":"wrk_c5b177f049bf44f7aefeb315af5594bd","modified":1620404599266,"created":1620404599266,"fileName":"Insomnia","contents":"","contentType":"yaml","_type":"api_spec"}]}

src/registry/federation/deactivate-schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const schema: FastifySchema = {
1818
}
1919

2020
export default function deactivateSchema(fastify: FastifyInstance) {
21-
fastify.post<RequestContext>('/schema/deactivate', async (req, res) => {
21+
fastify.put<RequestContext>('/schema/deactivate', async (req, res) => {
2222
return fastify.knex.transaction(async function (trx) {
2323
const schemaRepository = new SchemaRepository(trx)
2424
const schema = await schemaRepository.findById(req.body.schemaId)

0 commit comments

Comments
 (0)