Updating output schemas and adding examples to everything.

This commit is contained in:
mike12345567 2022-02-22 14:10:01 +00:00
parent 7443a17458
commit 710a340006
13 changed files with 1463 additions and 142 deletions

View File

@ -43,12 +43,90 @@ const table = {
}, },
} }
const query = {
_id: "query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e",
datasourceId: "datasource_plus_4d8be0c506b9465daf4bf84d890fdab6",
parameters: [],
fields: {
sql: "select * from persons",
},
queryVerb: "read",
name: "Help",
schema: {
personid: {
name: "personid",
type: "string",
},
lastname: {
name: "lastname",
type: "string",
},
firstname: {
name: "firstname",
type: "string",
},
address: {
name: "address",
type: "string",
},
city: {
name: "city",
type: "string",
},
},
transformer: "return data",
readable: true,
}
const user = {
_id: "us_693a73206518477283a8d5ae31103252",
email: "test@test.com",
roles: {
app_957b12f943d348faa61db7e18e088d0f: "BASIC",
},
builder: {
global: false,
},
admin: {
global: true,
},
tenantId: "default",
status: "active",
budibaseAccess: true,
csrfToken: "9c70291d-7137-48f9-9166-99ab5473a3d4",
userId: "us_693a73206518477283a8d5ae31103252",
roleId: "ADMIN",
role: {
_id: "ADMIN",
name: "Admin",
permissionId: "admin",
inherits: "POWER",
},
}
const application = {
_id: "app_metadata",
appId: "app_dev_957b12f943d348faa61db7e18e088d0f",
version: "1.0.58-alpha.0",
name: "App name",
url: "/app-url",
tenantId: "default",
updatedAt: "2022-02-22T13:00:54.035Z",
createdAt: "2022-02-11T18:02:26.961Z",
status: "development",
lockedBy: user,
}
exports.table = { exports.table = {
value: table, value: {
table: table,
},
} }
exports.tables = { exports.tables = {
value: [table], value: {
tables: [table],
},
} }
exports.inputRow = { exports.inputRow = {
@ -56,13 +134,51 @@ exports.inputRow = {
} }
exports.row = { exports.row = {
value: row, value: {
row: row,
},
} }
exports.search = { exports.rows = {
value: { value: {
rows: [row], rows: [row],
hasNextPage: true, hasNextPage: true,
bookmark: 10, bookmark: 10,
}, },
} }
exports.user = {
value: {
user: user,
},
}
exports.users = {
value: {
users: [user],
},
}
exports.query = {
value: {
query: query,
},
}
exports.queries = {
value: {
queries: [query],
},
}
exports.application = {
value: {
application: application,
},
}
exports.applications = {
value: {
applications: [application],
},
}

View File

@ -75,6 +75,7 @@
"examples": { "examples": {
"table": { "table": {
"value": { "value": {
"table": {
"_id": "ta_5b1649e42a5b41dea4ef7742a36a7a70", "_id": "ta_5b1649e42a5b41dea4ef7742a36a7a70",
"name": "People", "name": "People",
"schema": { "schema": {
@ -95,9 +96,11 @@
} }
} }
} }
}
}, },
"tables": { "tables": {
"value": [ "value": {
"tables": [
{ {
"_id": "ta_5b1649e42a5b41dea4ef7742a36a7a70", "_id": "ta_5b1649e42a5b41dea4ef7742a36a7a70",
"name": "People", "name": "People",
@ -120,6 +123,7 @@
} }
} }
] ]
}
}, },
"inputRow": { "inputRow": {
"value": { "value": {
@ -135,6 +139,7 @@
}, },
"row": { "row": {
"value": { "value": {
"row": {
"_id": "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4", "_id": "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
"type": "row", "type": "row",
"tableId": "ta_5b1649e42a5b41dea4ef7742a36a7a70", "tableId": "ta_5b1649e42a5b41dea4ef7742a36a7a70",
@ -147,8 +152,9 @@
} }
] ]
} }
}
}, },
"search": { "rows": {
"value": { "value": {
"rows": [ "rows": [
{ {
@ -168,6 +174,226 @@
"hasNextPage": true, "hasNextPage": true,
"bookmark": 10 "bookmark": 10
} }
},
"user": {
"value": {
"user": {
"_id": "us_693a73206518477283a8d5ae31103252",
"email": "test@test.com",
"roles": {
"app_957b12f943d348faa61db7e18e088d0f": "BASIC"
},
"builder": {
"global": false
},
"admin": {
"global": true
},
"tenantId": "default",
"status": "active",
"budibaseAccess": true,
"csrfToken": "9c70291d-7137-48f9-9166-99ab5473a3d4",
"userId": "us_693a73206518477283a8d5ae31103252",
"roleId": "ADMIN",
"role": {
"_id": "ADMIN",
"name": "Admin",
"permissionId": "admin",
"inherits": "POWER"
}
}
}
},
"users": {
"value": {
"users": [
{
"_id": "us_693a73206518477283a8d5ae31103252",
"email": "test@test.com",
"roles": {
"app_957b12f943d348faa61db7e18e088d0f": "BASIC"
},
"builder": {
"global": false
},
"admin": {
"global": true
},
"tenantId": "default",
"status": "active",
"budibaseAccess": true,
"csrfToken": "9c70291d-7137-48f9-9166-99ab5473a3d4",
"userId": "us_693a73206518477283a8d5ae31103252",
"roleId": "ADMIN",
"role": {
"_id": "ADMIN",
"name": "Admin",
"permissionId": "admin",
"inherits": "POWER"
}
}
]
}
},
"query": {
"value": {
"query": {
"_id": "query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e",
"datasourceId": "datasource_plus_4d8be0c506b9465daf4bf84d890fdab6",
"parameters": [],
"fields": {
"sql": "select * from persons"
},
"queryVerb": "read",
"name": "Help",
"schema": {
"personid": {
"name": "personid",
"type": "string"
},
"lastname": {
"name": "lastname",
"type": "string"
},
"firstname": {
"name": "firstname",
"type": "string"
},
"address": {
"name": "address",
"type": "string"
},
"city": {
"name": "city",
"type": "string"
}
},
"transformer": "return data",
"readable": true
}
}
},
"queries": {
"value": {
"queries": [
{
"_id": "query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e",
"datasourceId": "datasource_plus_4d8be0c506b9465daf4bf84d890fdab6",
"parameters": [],
"fields": {
"sql": "select * from persons"
},
"queryVerb": "read",
"name": "Help",
"schema": {
"personid": {
"name": "personid",
"type": "string"
},
"lastname": {
"name": "lastname",
"type": "string"
},
"firstname": {
"name": "firstname",
"type": "string"
},
"address": {
"name": "address",
"type": "string"
},
"city": {
"name": "city",
"type": "string"
}
},
"transformer": "return data",
"readable": true
}
]
}
},
"application": {
"value": {
"application": {
"_id": "app_metadata",
"appId": "app_dev_957b12f943d348faa61db7e18e088d0f",
"version": "1.0.58-alpha.0",
"name": "App name",
"url": "/app-url",
"tenantId": "default",
"updatedAt": "2022-02-22T13:00:54.035Z",
"createdAt": "2022-02-11T18:02:26.961Z",
"status": "development",
"lockedBy": {
"_id": "us_693a73206518477283a8d5ae31103252",
"email": "test@test.com",
"roles": {
"app_957b12f943d348faa61db7e18e088d0f": "BASIC"
},
"builder": {
"global": false
},
"admin": {
"global": true
},
"tenantId": "default",
"status": "active",
"budibaseAccess": true,
"csrfToken": "9c70291d-7137-48f9-9166-99ab5473a3d4",
"userId": "us_693a73206518477283a8d5ae31103252",
"roleId": "ADMIN",
"role": {
"_id": "ADMIN",
"name": "Admin",
"permissionId": "admin",
"inherits": "POWER"
}
}
}
}
},
"applications": {
"value": {
"applications": [
{
"_id": "app_metadata",
"appId": "app_dev_957b12f943d348faa61db7e18e088d0f",
"version": "1.0.58-alpha.0",
"name": "App name",
"url": "/app-url",
"tenantId": "default",
"updatedAt": "2022-02-22T13:00:54.035Z",
"createdAt": "2022-02-11T18:02:26.961Z",
"status": "development",
"lockedBy": {
"_id": "us_693a73206518477283a8d5ae31103252",
"email": "test@test.com",
"roles": {
"app_957b12f943d348faa61db7e18e088d0f": "BASIC"
},
"builder": {
"global": false
},
"admin": {
"global": true
},
"tenantId": "default",
"status": "active",
"budibaseAccess": true,
"csrfToken": "9c70291d-7137-48f9-9166-99ab5473a3d4",
"userId": "us_693a73206518477283a8d5ae31103252",
"roleId": "ADMIN",
"role": {
"_id": "ADMIN",
"name": "Admin",
"permissionId": "admin",
"inherits": "POWER"
}
}
}
]
}
} }
}, },
"securitySchemes": { "securitySchemes": {
@ -405,6 +631,248 @@
"application": { "application": {
"type": "object", "type": "object",
"properties": {} "properties": {}
},
"applicationOutput": {
"type": "object",
"properties": {
"application": {
"type": "object",
"properties": {}
}
}
},
"tableOutput": {
"type": "object",
"properties": {
"table": {
"description": "The table to be created/updated.",
"type": "object",
"properties": {
"name": {
"description": "The name of the table",
"type": "string"
},
"primaryDisplay": {
"type": "string",
"description": "The name of the column which should be used in relationship tags when relating to this table."
},
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"link"
],
"description": "A relationship column."
},
"constraints": {
"type": "object",
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"number",
"object",
"boolean"
]
},
"presence": {
"type": "boolean",
"description": "Defines whether the column is required or not."
}
}
},
"name": {
"type": "string",
"description": "The name of the column."
},
"autocolumn": {
"type": "boolean",
"description": "Defines whether the column is automatically generated."
},
"fieldName": {
"type": "string",
"description": "The name of the column which a relationship column is related to in another table."
},
"tableId": {
"type": "string",
"description": "The ID of the table which a relationship column is related to."
},
"relationshipType": {
"type": "string",
"enum": [
"one-to-many",
"many-to-one",
"many-to-many"
],
"description": "Defines the type of relationship that this column will be used for."
},
"through": {
"type": "string",
"description": "When using a SQL table that contains many to many relationships this defines the table the relationships are linked through."
},
"foreignKey": {
"type": "string",
"description": "When using a SQL table that contains a one to many relationship this defines the foreign key."
},
"throughFrom": {
"type": "string",
"description": "When using a SQL table that utilises a through table, this defines the primary key in the through table for this table."
},
"throughTo": {
"type": "string",
"description": "When using a SQL table that utilises a through table, this defines the primary key in the through table for the related table."
}
}
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"formula"
],
"description": "A formula column."
},
"constraints": {
"type": "object",
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"number",
"object",
"boolean"
]
},
"presence": {
"type": "boolean",
"description": "Defines whether the column is required or not."
}
}
},
"name": {
"type": "string",
"description": "The name of the column."
},
"autocolumn": {
"type": "boolean",
"description": "Defines whether the column is automatically generated."
},
"formula": {
"type": "string",
"description": "Defines a Handlebars or JavaScript formula to use, note that Javascript formulas are expected to be provided in the base64 format."
},
"formulaType": {
"type": "string",
"enum": [
"static",
"dynamic"
],
"description": "Defines whether this is a static or dynamic formula."
}
}
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"longform",
"options",
"number",
"boolean",
"array",
"datetime",
"attachment",
"link",
"formula",
"auto",
"json",
"internal"
],
"description": "Defines the type of the column, most explain themselves, a link column is a relationship."
},
"constraints": {
"type": "object",
"description": "A constraint can be applied to the column which will be validated against when a row is saved.",
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"number",
"object",
"boolean"
]
},
"presence": {
"type": "boolean",
"description": "Defines whether the column is required or not."
}
}
},
"name": {
"type": "string",
"description": "The name of the column."
},
"autocolumn": {
"type": "boolean",
"description": "Defines whether the column is automatically generated."
}
}
}
]
}
}
}
}
},
"userOutput": {
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {}
}
}
},
"rowOutput": {
"properties": {
"row": {
"description": "The row to be created/updated, based on the table schema.",
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "integer"
},
{
"type": "array"
},
{
"type": "boolean"
}
]
}
}
}
} }
} }
}, },
@ -431,12 +899,22 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object",
"properties": {
"applications": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/application" "$ref": "#/components/schemas/application"
} }
} }
} }
},
"examples": {
"applications": {
"$ref": "#/components/examples/applications"
}
}
}
} }
} }
} }
@ -459,7 +937,12 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/applicationOutput"
},
"examples": {
"application": {
"$ref": "#/components/examples/application"
}
} }
} }
} }
@ -484,7 +967,12 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/applicationOutput"
},
"examples": {
"application": {
"$ref": "#/components/examples/application"
}
} }
} }
} }
@ -507,7 +995,40 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/applicationOutput"
},
"examples": {
"application": {
"$ref": "#/components/examples/application"
}
}
}
}
}
}
},
"get": {
"summary": "Retrieve a single application by its ID.",
"tags": [
"applications"
],
"parameters": [
{
"$ref": "#/components/parameters/appIdUrl"
}
],
"responses": {
"200": {
"description": "Returns the retrieved application.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/applicationOutput"
},
"examples": {
"application": {
"$ref": "#/components/examples/application"
}
} }
} }
} }
@ -532,12 +1053,22 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object",
"properties": {
"queries": {
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/components/schemas/query" "$ref": "#/components/schemas/query"
} }
} }
} }
},
"examples": {
"queries": {
"$ref": "#/components/examples/queries"
}
}
}
} }
} }
} }
@ -567,6 +1098,11 @@
"items": { "items": {
"type": "object" "type": "object"
} }
},
"examples": {
"query": {
"$ref": "#/components/examples/query"
}
} }
} }
} }
@ -733,7 +1269,7 @@
}, },
"examples": { "examples": {
"search": { "search": {
"$ref": "#/components/examples/search" "$ref": "#/components/examples/rows"
} }
} }
} }
@ -777,7 +1313,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/rowOutput"
}, },
"examples": { "examples": {
"row": { "row": {
@ -828,7 +1364,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/rowOutput"
}, },
"examples": { "examples": {
"row": { "row": {
@ -862,7 +1398,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/rowOutput"
}, },
"examples": { "examples": {
"row": { "row": {
@ -896,7 +1432,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/rowOutput"
}, },
"examples": { "examples": {
"row": { "row": {
@ -941,9 +1477,14 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object",
"properties": {
"applications": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object" "$ref": "#/components/schemas/table"
}
}
} }
}, },
"examples": { "examples": {
@ -988,7 +1529,7 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/tableOutput"
}, },
"examples": { "examples": {
"table": { "table": {
@ -1035,11 +1576,11 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/tableOutput"
}, },
"examples": { "examples": {
"table": { "table": {
"$ref": "#/components/examples/row" "$ref": "#/components/examples/table"
} }
} }
} }
@ -1068,7 +1609,38 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/tableOutput"
},
"examples": {
"table": {
"$ref": "#/components/examples/table"
}
}
}
}
}
}
},
"get": {
"summary": "Gets a single table by its ID.",
"tags": [
"tables"
],
"parameters": [
{
"$ref": "#/components/parameters/tableId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the retrieved table.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/tableOutput"
}, },
"examples": { "examples": {
"table": { "table": {
@ -1102,6 +1674,11 @@
"items": { "items": {
"$ref": "#/components/schemas/user" "$ref": "#/components/schemas/user"
} }
},
"examples": {
"users": {
"$ref": "#/components/examples/users"
}
} }
} }
} }
@ -1126,7 +1703,12 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/userOutput"
},
"examples": {
"user": {
"$ref": "#/components/examples/user"
}
} }
} }
} }
@ -1154,7 +1736,12 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/userOutput"
},
"examples": {
"user": {
"$ref": "#/components/examples/user"
}
} }
} }
} }
@ -1180,7 +1767,43 @@
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "$ref": "#/components/schemas/userOutput"
},
"examples": {
"user": {
"$ref": "#/components/examples/user"
}
}
}
}
}
}
},
"get": {
"summary": "Retrieve a single user by their ID.",
"tags": [
"users"
],
"parameters": [
{
"$ref": "#/components/parameters/userId"
},
{
"$ref": "#/components/parameters/appId"
}
],
"responses": {
"200": {
"description": "Returns the retrieved user.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/userOutput"
},
"examples": {
"user": {
"$ref": "#/components/examples/user"
}
} }
} }
} }

View File

@ -55,6 +55,7 @@ components:
examples: examples:
table: table:
value: value:
table:
_id: ta_5b1649e42a5b41dea4ef7742a36a7a70 _id: ta_5b1649e42a5b41dea4ef7742a36a7a70
name: People name: People
schema: schema:
@ -72,6 +73,7 @@ components:
relationshipType: many-to-many relationshipType: many-to-many
tables: tables:
value: value:
tables:
- _id: ta_5b1649e42a5b41dea4ef7742a36a7a70 - _id: ta_5b1649e42a5b41dea4ef7742a36a7a70
name: People name: People
schema: schema:
@ -98,6 +100,7 @@ components:
- ro_ta_... - ro_ta_...
row: row:
value: value:
row:
_id: ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4 _id: ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4
type: row type: row
tableId: ta_5b1649e42a5b41dea4ef7742a36a7a70 tableId: ta_5b1649e42a5b41dea4ef7742a36a7a70
@ -106,7 +109,7 @@ components:
relationship: relationship:
- primaryDisplay: Joe - primaryDisplay: Joe
_id: ro_ta_... _id: ro_ta_...
search: rows:
value: value:
rows: rows:
- _id: ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4 - _id: ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4
@ -119,6 +122,170 @@ components:
_id: ro_ta_... _id: ro_ta_...
hasNextPage: true hasNextPage: true
bookmark: 10 bookmark: 10
user:
value:
user:
_id: us_693a73206518477283a8d5ae31103252
email: test@test.com
roles:
app_957b12f943d348faa61db7e18e088d0f: BASIC
builder:
global: false
admin:
global: true
tenantId: default
status: active
budibaseAccess: true
csrfToken: 9c70291d-7137-48f9-9166-99ab5473a3d4
userId: us_693a73206518477283a8d5ae31103252
roleId: ADMIN
role:
_id: ADMIN
name: Admin
permissionId: admin
inherits: POWER
users:
value:
users:
- _id: us_693a73206518477283a8d5ae31103252
email: test@test.com
roles:
app_957b12f943d348faa61db7e18e088d0f: BASIC
builder:
global: false
admin:
global: true
tenantId: default
status: active
budibaseAccess: true
csrfToken: 9c70291d-7137-48f9-9166-99ab5473a3d4
userId: us_693a73206518477283a8d5ae31103252
roleId: ADMIN
role:
_id: ADMIN
name: Admin
permissionId: admin
inherits: POWER
query:
value:
query:
_id: query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e
datasourceId: datasource_plus_4d8be0c506b9465daf4bf84d890fdab6
parameters: []
fields:
sql: select * from persons
queryVerb: read
name: Help
schema:
personid:
name: personid
type: string
lastname:
name: lastname
type: string
firstname:
name: firstname
type: string
address:
name: address
type: string
city:
name: city
type: string
transformer: return data
readable: true
queries:
value:
queries:
- _id: query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e
datasourceId: datasource_plus_4d8be0c506b9465daf4bf84d890fdab6
parameters: []
fields:
sql: select * from persons
queryVerb: read
name: Help
schema:
personid:
name: personid
type: string
lastname:
name: lastname
type: string
firstname:
name: firstname
type: string
address:
name: address
type: string
city:
name: city
type: string
transformer: return data
readable: true
application:
value:
application:
_id: app_metadata
appId: app_dev_957b12f943d348faa61db7e18e088d0f
version: 1.0.58-alpha.0
name: App name
url: /app-url
tenantId: default
updatedAt: 2022-02-22T13:00:54.035Z
createdAt: 2022-02-11T18:02:26.961Z
status: development
lockedBy:
_id: us_693a73206518477283a8d5ae31103252
email: test@test.com
roles:
app_957b12f943d348faa61db7e18e088d0f: BASIC
builder:
global: false
admin:
global: true
tenantId: default
status: active
budibaseAccess: true
csrfToken: 9c70291d-7137-48f9-9166-99ab5473a3d4
userId: us_693a73206518477283a8d5ae31103252
roleId: ADMIN
role:
_id: ADMIN
name: Admin
permissionId: admin
inherits: POWER
applications:
value:
applications:
- _id: app_metadata
appId: app_dev_957b12f943d348faa61db7e18e088d0f
version: 1.0.58-alpha.0
name: App name
url: /app-url
tenantId: default
updatedAt: 2022-02-22T13:00:54.035Z
createdAt: 2022-02-11T18:02:26.961Z
status: development
lockedBy:
_id: us_693a73206518477283a8d5ae31103252
email: test@test.com
roles:
app_957b12f943d348faa61db7e18e088d0f: BASIC
builder:
global: false
admin:
global: true
tenantId: default
status: active
budibaseAccess: true
csrfToken: 9c70291d-7137-48f9-9166-99ab5473a3d4
userId: us_693a73206518477283a8d5ae31103252
roleId: ADMIN
role:
_id: ADMIN
name: Admin
permissionId: admin
inherits: POWER
securitySchemes: securitySchemes:
ApiKeyAuth: ApiKeyAuth:
type: apiKey type: apiKey
@ -297,6 +464,186 @@ components:
application: application:
type: object type: object
properties: {} properties: {}
applicationOutput:
type: object
properties:
application:
type: object
properties: {}
tableOutput:
type: object
properties:
table:
description: The table to be created/updated.
type: object
properties:
name:
description: The name of the table
type: string
primaryDisplay:
type: string
description: The name of the column which should be used in relationship tags
when relating to this table.
schema:
oneOf:
- type: object
properties:
type:
type: string
enum:
- link
description: A relationship column.
constraints:
type: object
description: A constraint can be applied to the column which will be validated
against when a row is saved.
properties:
type:
type: string
enum:
- string
- number
- object
- boolean
presence:
type: boolean
description: Defines whether the column is required or not.
name:
type: string
description: The name of the column.
autocolumn:
type: boolean
description: Defines whether the column is automatically generated.
fieldName:
type: string
description: The name of the column which a relationship column is related to in
another table.
tableId:
type: string
description: The ID of the table which a relationship column is related to.
relationshipType:
type: string
enum:
- one-to-many
- many-to-one
- many-to-many
description: Defines the type of relationship that this column will be used for.
through:
type: string
description: When using a SQL table that contains many to many relationships
this defines the table the relationships are linked
through.
foreignKey:
type: string
description: When using a SQL table that contains a one to many relationship
this defines the foreign key.
throughFrom:
type: string
description: When using a SQL table that utilises a through table, this defines
the primary key in the through table for this table.
throughTo:
type: string
description: When using a SQL table that utilises a through table, this defines
the primary key in the through table for the related
table.
- type: object
properties:
type:
type: string
enum:
- formula
description: A formula column.
constraints:
type: object
description: A constraint can be applied to the column which will be validated
against when a row is saved.
properties:
type:
type: string
enum:
- string
- number
- object
- boolean
presence:
type: boolean
description: Defines whether the column is required or not.
name:
type: string
description: The name of the column.
autocolumn:
type: boolean
description: Defines whether the column is automatically generated.
formula:
type: string
description: Defines a Handlebars or JavaScript formula to use, note that
Javascript formulas are expected to be provided in the
base64 format.
formulaType:
type: string
enum:
- static
- dynamic
description: Defines whether this is a static or dynamic formula.
- type: object
properties:
type:
type: string
enum:
- string
- longform
- options
- number
- boolean
- array
- datetime
- attachment
- link
- formula
- auto
- json
- internal
description: Defines the type of the column, most explain themselves, a link
column is a relationship.
constraints:
type: object
description: A constraint can be applied to the column which will be validated
against when a row is saved.
properties:
type:
type: string
enum:
- string
- number
- object
- boolean
presence:
type: boolean
description: Defines whether the column is required or not.
name:
type: string
description: The name of the column.
autocolumn:
type: boolean
description: Defines whether the column is automatically generated.
userOutput:
type: object
properties:
user:
type: object
properties: {}
rowOutput:
properties:
row:
description: The row to be created/updated, based on the table schema.
type: object
additionalProperties:
oneOf:
- type: string
- type: object
- type: integer
- type: array
- type: boolean
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []
paths: paths:
@ -314,9 +661,15 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object
properties:
applications:
type: array type: array
items: items:
$ref: "#/components/schemas/application" $ref: "#/components/schemas/application"
examples:
applications:
$ref: "#/components/examples/applications"
/applications: /applications:
post: post:
summary: Create a new application. summary: Create a new application.
@ -330,7 +683,10 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/applicationOutput"
examples:
application:
$ref: "#/components/examples/application"
"/applications/{appId}": "/applications/{appId}":
put: put:
summary: Update an existing application by its ID. summary: Update an existing application by its ID.
@ -344,7 +700,10 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/applicationOutput"
examples:
application:
$ref: "#/components/examples/application"
delete: delete:
summary: Delete an existing application by its ID. summary: Delete an existing application by its ID.
tags: tags:
@ -357,7 +716,26 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/applicationOutput"
examples:
application:
$ref: "#/components/examples/application"
get:
summary: Retrieve a single application by its ID.
tags:
- applications
parameters:
- $ref: "#/components/parameters/appIdUrl"
responses:
"200":
description: Returns the retrieved application.
content:
application/json:
schema:
$ref: "#/components/schemas/applicationOutput"
examples:
application:
$ref: "#/components/examples/application"
/queries/search: /queries/search:
post: post:
summary: Search for a query based on its name. summary: Search for a query based on its name.
@ -371,9 +749,15 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object
properties:
queries:
type: array type: array
items: items:
$ref: "#/components/schemas/query" $ref: "#/components/schemas/query"
examples:
queries:
$ref: "#/components/examples/queries"
"/queries/{queryId}": "/queries/{queryId}":
post: post:
summary: Execute a query and retrieve its response. summary: Execute a query and retrieve its response.
@ -391,6 +775,9 @@ paths:
type: array type: array
items: items:
type: object type: object
examples:
query:
$ref: "#/components/examples/query"
"/tables/{tableId}/rows/search": "/tables/{tableId}/rows/search":
post: post:
summary: Used to search for rows within a table. summary: Used to search for rows within a table.
@ -513,7 +900,7 @@ paths:
type: boolean type: boolean
examples: examples:
search: search:
$ref: "#/components/examples/search" $ref: "#/components/examples/rows"
"/tables/{tableId}/rows": "/tables/{tableId}/rows":
post: post:
summary: Creates a new row within a specified table. summary: Creates a new row within a specified table.
@ -539,7 +926,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/rowOutput"
examples: examples:
row: row:
$ref: "#/components/examples/row" $ref: "#/components/examples/row"
@ -568,7 +955,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/rowOutput"
examples: examples:
row: row:
$ref: "#/components/examples/row" $ref: "#/components/examples/row"
@ -587,7 +974,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/rowOutput"
examples: examples:
row: row:
$ref: "#/components/examples/row" $ref: "#/components/examples/row"
@ -605,7 +992,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/rowOutput"
examples: examples:
row: row:
$ref: "#/components/examples/row" $ref: "#/components/examples/row"
@ -632,9 +1019,12 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object
properties:
applications:
type: array type: array
items: items:
type: object $ref: "#/components/schemas/table"
examples: examples:
tables: tables:
$ref: "#/components/examples/tables" $ref: "#/components/examples/tables"
@ -660,7 +1050,7 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/tableOutput"
examples: examples:
table: table:
$ref: "#/components/examples/table" $ref: "#/components/examples/table"
@ -686,10 +1076,10 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/tableOutput"
examples: examples:
table: table:
$ref: "#/components/examples/row" $ref: "#/components/examples/table"
"/tables/{tableId}": "/tables/{tableId}":
delete: delete:
summary: Delete a single table and all of its data. summary: Delete a single table and all of its data.
@ -704,7 +1094,24 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/tableOutput"
examples:
table:
$ref: "#/components/examples/table"
get:
summary: Gets a single table by its ID.
tags:
- tables
parameters:
- $ref: "#/components/parameters/tableId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the retrieved table.
content:
application/json:
schema:
$ref: "#/components/schemas/tableOutput"
examples: examples:
table: table:
$ref: "#/components/examples/table" $ref: "#/components/examples/table"
@ -724,6 +1131,9 @@ paths:
type: array type: array
items: items:
$ref: "#/components/schemas/user" $ref: "#/components/schemas/user"
examples:
users:
$ref: "#/components/examples/users"
/users: /users:
post: post:
summary: Create a new user in the Budibase portal. summary: Create a new user in the Budibase portal.
@ -737,7 +1147,10 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/userOutput"
examples:
user:
$ref: "#/components/examples/user"
"/users/{userId}": "/users/{userId}":
put: put:
summary: Update an existing user by their ID. summary: Update an existing user by their ID.
@ -752,7 +1165,10 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/userOutput"
examples:
user:
$ref: "#/components/examples/user"
delete: delete:
summary: Delete an existing user by their ID. summary: Delete an existing user by their ID.
tags: tags:
@ -766,5 +1182,25 @@ paths:
content: content:
application/json: application/json:
schema: schema:
type: object $ref: "#/components/schemas/userOutput"
examples:
user:
$ref: "#/components/examples/user"
get:
summary: Retrieve a single user by their ID.
tags:
- users
parameters:
- $ref: "#/components/parameters/userId"
- $ref: "#/components/parameters/appId"
responses:
"200":
description: Returns the retrieved user.
content:
application/json:
schema:
$ref: "#/components/schemas/userOutput"
examples:
user:
$ref: "#/components/examples/user"
tags: [] tags: []

View File

@ -158,3 +158,30 @@ exports.application = {
type: "object", type: "object",
properties: {}, properties: {},
} }
exports.applicationOutput = {
type: "object",
properties: {
application: exports.application,
},
}
exports.tableOutput = {
type: "object",
properties: {
table: exports.table,
},
}
exports.userOutput = {
type: "object",
properties: {
user: exports.user,
},
}
exports.rowOutput = {
properties: {
row: exports.row,
},
}

View File

@ -6,6 +6,10 @@ exports.create = () => {
} }
exports.read = () => {
}
exports.update = () => { exports.update = () => {
} }

View File

@ -24,7 +24,7 @@ exports.create = () => {
ctx.request.body = fixRow(ctx.request.body, ctx.params) ctx.request.body = fixRow(ctx.request.body, ctx.params)
} }
exports.singleRead = () => { exports.read = () => {
} }

View File

@ -6,6 +6,10 @@ exports.create = () => {
} }
exports.read = () => {
}
exports.update = () => { exports.update = () => {
} }

View File

@ -6,6 +6,10 @@ exports.create = () => {
} }
exports.read = () => {
}
exports.update = () => { exports.update = () => {
} }

View File

@ -18,9 +18,15 @@ const router = Router()
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object
* properties:
* applications:
* type: array * type: array
* items: * items:
* $ref: '#/components/schemas/application' * $ref: '#/components/schemas/application'
* examples:
* applications:
* $ref: '#/components/examples/applications'
*/ */
router.post("/applications/search", controller.search) router.post("/applications/search", controller.search)
@ -39,7 +45,10 @@ router.post("/applications/search", controller.search)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/applicationOutput'
* examples:
* application:
* $ref: '#/components/examples/application'
*/ */
router.post("/applications", controller.create) router.post("/applications", controller.create)
@ -58,7 +67,10 @@ router.post("/applications", controller.create)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/applicationOutput'
* examples:
* application:
* $ref: '#/components/examples/application'
*/ */
router.put("/applications/:appId", controller.update) router.put("/applications/:appId", controller.update)
@ -77,8 +89,33 @@ router.put("/applications/:appId", controller.update)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/applicationOutput'
* examples:
* application:
* $ref: '#/components/examples/application'
*/ */
router.delete("/applications/:appId", controller.delete) router.delete("/applications/:appId", controller.delete)
/**
* @openapi
* /applications/{appId}:
* get:
* summary: Retrieve a single application by its ID.
* tags:
* - applications
* parameters:
* - $ref: '#/components/parameters/appIdUrl'
* responses:
* 200:
* description: Returns the retrieved application.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/applicationOutput'
* examples:
* application:
* $ref: '#/components/examples/application'
*/
router.get("/applications/:appId", controller.read)
module.exports = router module.exports = router

View File

@ -18,9 +18,15 @@ const router = Router()
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object
* properties:
* queries:
* type: array * type: array
* items: * items:
* $ref: '#/components/schemas/query' * $ref: '#/components/schemas/query'
* examples:
* queries:
* $ref: '#/components/examples/queries'
*/ */
router.post("/queries/search", controller.search) router.post("/queries/search", controller.search)
@ -43,6 +49,9 @@ router.post("/queries/search", controller.search)
* type: array * type: array
* items: * items:
* type: object * type: object
* examples:
* query:
* $ref: '#/components/examples/query'
*/ */
router.post("/queries/:queryId", controller.execute) router.post("/queries/:queryId", controller.execute)

View File

@ -117,7 +117,7 @@ const router = Router()
* type: boolean * type: boolean
* examples: * examples:
* search: * search:
* $ref: '#/components/examples/search' * $ref: '#/components/examples/rows'
*/ */
router.post("/tables/:tableId/rows/search", controller.search) router.post("/tables/:tableId/rows/search", controller.search)
@ -147,7 +147,7 @@ router.post("/tables/:tableId/rows/search", controller.search)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/rowOutput'
* examples: * examples:
* row: * row:
* $ref: '#/components/examples/row' * $ref: '#/components/examples/row'
@ -180,7 +180,7 @@ router.post("/tables/:tableId/rows", controller.create)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/rowOutput'
* examples: * examples:
* row: * row:
* $ref: '#/components/examples/row' * $ref: '#/components/examples/row'
@ -204,7 +204,7 @@ router.put("/tables/:tableId/rows/:rowId", controller.update)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/rowOutput'
* examples: * examples:
* row: * row:
* $ref: '#/components/examples/row' * $ref: '#/components/examples/row'
@ -228,11 +228,11 @@ router.delete("/tables/:tableId/rows/:rowId", controller.delete)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/rowOutput'
* examples: * examples:
* row: * row:
* $ref: '#/components/examples/row' * $ref: '#/components/examples/row'
*/ */
router.get("/tables/:tableId/rows/:rowId", controller.singleRead) router.get("/tables/:tableId/rows/:rowId", controller.read)
module.exports = router module.exports = router

View File

@ -28,9 +28,12 @@ const router = Router()
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object
* properties:
* applications:
* type: array * type: array
* items: * items:
* type: object * $ref: '#/components/schemas/table'
* examples: * examples:
* tables: * tables:
* $ref: '#/components/examples/tables' * $ref: '#/components/examples/tables'
@ -61,7 +64,7 @@ router.post("/tables/search", controller.search)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/tableOutput'
* examples: * examples:
* table: * table:
* $ref: '#/components/examples/table' * $ref: '#/components/examples/table'
@ -92,10 +95,10 @@ router.post("/tables", controller.create)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/tableOutput'
* examples: * examples:
* table: * table:
* $ref: '#/components/examples/row' * $ref: '#/components/examples/table'
*/ */
router.put("/tables/:tableId", controller.update) router.put("/tables/:tableId", controller.update)
@ -115,11 +118,34 @@ router.put("/tables/:tableId", controller.update)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/tableOutput'
* examples: * examples:
* table: * table:
* $ref: '#/components/examples/table' * $ref: '#/components/examples/table'
*/ */
router.delete("/tables/:tableId", controller.delete) router.delete("/tables/:tableId", controller.delete)
/**
* @openapi
* /tables/{tableId}:
* get:
* summary: Gets a single table by its ID.
* tags:
* - tables
* parameters:
* - $ref: '#/components/parameters/tableId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the retrieved table.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/tableOutput'
* examples:
* table:
* $ref: '#/components/examples/table'
*/
router.get("/tables/:tableId", controller.read)
module.exports = router module.exports = router

View File

@ -21,6 +21,9 @@ const router = Router()
* type: array * type: array
* items: * items:
* $ref: '#/components/schemas/user' * $ref: '#/components/schemas/user'
* examples:
* users:
* $ref: '#/components/examples/users'
*/ */
router.post("/users/search", controller.search) router.post("/users/search", controller.search)
@ -39,7 +42,10 @@ router.post("/users/search", controller.search)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/userOutput'
* examples:
* user:
* $ref: '#/components/examples/user'
*/ */
router.post("/users", controller.create) router.post("/users", controller.create)
@ -59,7 +65,10 @@ router.post("/users", controller.create)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/userOutput'
* examples:
* user:
* $ref: '#/components/examples/user'
*/ */
router.put("/users/:userId", controller.update) router.put("/users/:userId", controller.update)
@ -79,8 +88,34 @@ router.put("/users/:userId", controller.update)
* content: * content:
* application/json: * application/json:
* schema: * schema:
* type: object * $ref: '#/components/schemas/userOutput'
* examples:
* user:
* $ref: '#/components/examples/user'
*/ */
router.delete("/users/:userId", controller.delete) router.delete("/users/:userId", controller.delete)
/**
* @openapi
* /users/{userId}:
* get:
* summary: Retrieve a single user by their ID.
* tags:
* - users
* parameters:
* - $ref: '#/components/parameters/userId'
* - $ref: '#/components/parameters/appId'
* responses:
* 200:
* description: Returns the retrieved user.
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/userOutput'
* examples:
* user:
* $ref: '#/components/examples/user'
*/
router.get("/users/:userId", controller.read)
module.exports = router module.exports = router