save
This commit is contained in:
5
.wundergraph/operations/Cloudron.graphql
Normal file
5
.wundergraph/operations/Cloudron.graphql
Normal file
@ -0,0 +1,5 @@
|
||||
query {
|
||||
cloudron_getProfile {
|
||||
email
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
query Dragons {
|
||||
spacex_dragons {
|
||||
name
|
||||
active
|
||||
}
|
||||
}
|
11
.wundergraph/operations/Me.graphql
Normal file
11
.wundergraph/operations/Me.graphql
Normal file
@ -0,0 +1,11 @@
|
||||
query {
|
||||
system_db_users_me {
|
||||
id
|
||||
first_name
|
||||
last_name
|
||||
avatar {
|
||||
id
|
||||
}
|
||||
external_identifier
|
||||
}
|
||||
}
|
5195
.wundergraph/schemas/cloudron.json
Normal file
5195
.wundergraph/schemas/cloudron.json
Normal file
File diff suppressed because it is too large
Load Diff
181
.wundergraph/schemas/placeholder.json
Normal file
181
.wundergraph/schemas/placeholder.json
Normal file
@ -0,0 +1,181 @@
|
||||
{
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"version": "1.0.0",
|
||||
"title": "JSON Placeholder API",
|
||||
"description": "See https://jsonplaceholder.typicode.com/"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://jsonplaceholder.typicode.com"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/posts": {
|
||||
"get": {
|
||||
"description": "Returns all posts",
|
||||
"tags": [
|
||||
"Posts"
|
||||
],
|
||||
"operationId": "getPosts",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/PostsList"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users": {
|
||||
"get": {
|
||||
"description": "Returns all users",
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"operationId": "getUsers",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/UserList"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/users/{id}": {
|
||||
"get": {
|
||||
"description": "Returns a user by id",
|
||||
"tags": [
|
||||
"Users"
|
||||
],
|
||||
"operationId": "getUser",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "The user id.",
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "User not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/posts/{id}": {
|
||||
"get": {
|
||||
"description": "Returns a post by id",
|
||||
"tags": [
|
||||
"Posts"
|
||||
],
|
||||
"operationId": "getPost",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"description": "The user id.",
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Successful response",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Post"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Post not found"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"schemas": {
|
||||
"PostsList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/Post"
|
||||
}
|
||||
},
|
||||
"UserList": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/User"
|
||||
}
|
||||
},
|
||||
"Post": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"userId",
|
||||
"title"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"userId": {
|
||||
"type": "integer"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,11 +9,6 @@ dotenv.config();
|
||||
const directusSchema = fs.readFileSync(path.join(path.resolve(), './schemas/directus.graphql'), 'utf8');
|
||||
const directusSystemSchema = fs.readFileSync(path.join(path.resolve(), './schemas/directus_system.graphql'), 'utf8');
|
||||
|
||||
const spaceX = introspect.graphql({
|
||||
apiNamespace: 'spacex',
|
||||
url: 'https://spacex-api.fly.dev/graphql/',
|
||||
});
|
||||
|
||||
const db = introspect.graphql({
|
||||
apiNamespace: 'db',
|
||||
loadSchemaFromString: directusSchema,
|
||||
@ -22,6 +17,25 @@ const db = introspect.graphql({
|
||||
.addStaticHeader('Authorization', new EnvironmentVariable('DIRECTUS', process.env.DIRECTUS))
|
||||
});
|
||||
|
||||
const placeholder = introspect.openApiV2({
|
||||
apiNamespace: 'placeholder',
|
||||
source: {
|
||||
kind: "file",
|
||||
filePath: "./schemas/placeholder.json"
|
||||
},
|
||||
baseURL: 'https://jsonplaceholder.typicode.com',
|
||||
});
|
||||
|
||||
const cloudron = introspect.openApiV2({
|
||||
apiNamespace: 'cloudron',
|
||||
source: {
|
||||
kind: "file",
|
||||
filePath: "./schemas/cloudron.json"
|
||||
},
|
||||
headers: (builder) => builder
|
||||
.addStaticHeader('Authorization', new EnvironmentVariable('CLOUDRON_API', process.env.CLOUDRON_API))
|
||||
});
|
||||
|
||||
const system_db = introspect.graphql({
|
||||
apiNamespace: 'system_db',
|
||||
loadSchemaFromString: directusSystemSchema,
|
||||
@ -32,7 +46,7 @@ const system_db = introspect.graphql({
|
||||
|
||||
// configureWunderGraph emits the configuration
|
||||
configureWunderGraphApplication({
|
||||
apis: [spaceX, db, system_db],
|
||||
apis: [db, system_db, placeholder, cloudron],
|
||||
server,
|
||||
operations,
|
||||
generate: {
|
||||
|
Reference in New Issue
Block a user