Skip to content

Instantly share code, notes, and snippets.

View xuorig's full-sized avatar

Marc-Andre Giroux xuorig

View GitHub Profile
This file has been truncated, but you can view the full file.
{
"version": null,
"servers": {
"added": [
{
"url": "{protocol}://{hostname}",
"variables": {
"hostname": {
"default": "HOSTNAME",
"description": "Self-hosted Enterprise Server or Enterprise Cloud hostname"
@xuorig
xuorig / diff.md
Created July 28, 2021 17:58
diff between 2.18 and 3.1

OpenAPI diff

Paths

  • GET /app/hook/config (apps/get-webhook-config-for-app) was added.
  • PATCH /app/hook/config (apps/update-webhook-config-for-app) was added.
  • PUT /app/installations/{installation_id}/suspended (apps/suspend-installation) was added.
  • POST /applications/{client_id}/token (apps/check-token) was added.
  • PATCH /applications/{client_id}/token (apps/reset-token) was added.
// Source: https://www.w3schools.com/php/php_mysql_select.asp
// This is a joke
<?php
echo "<table style='border: solid 1px black;'>";
echo "<tr><th>Id</th><th>Firstname</th><th>Lastname</th></tr>";
class TableRows extends RecursiveIteratorIterator {
function __construct($it) {
parent::__construct($it, self::LEAVES_ONLY);
query {
shop {
name
description
products @defer { # <===== server can send this later
name
price
}
}
}
query ThisGonnaBeBad {
user(id: "1") { name }
user(id: "2") { name }
user(id: "3") { name }
user(id: "4") { name }
user(id: "5") { name }
user(id: "6") { name }
}
class OnlyFilter
def self.call(schema_member, context)
return true unless visibility_proc = schema_member.metadata[:visibility_proc]
visibility_proc.call(context)
end
end
GraphQL::ObjectType.define do
name "Person"
field :name, types.String
field :bankAccount, BankAccount do
visibility ->(ctx) { ctx[:current_user].bank_account_access? }
end
end
GraphQL::Field.accepts_definitions(
visibility: ->(field, visibility_proc) { field.metadata[:visibility_proc] = visibility_proc }
)
GraphQL::Field.accepts_definitions(
topsecret: ->(field, topsecret) { field.metadata[:topsecret] = topsecret }
)