1
0
Fork 0
mirror of synced 2024-07-14 18:55:45 +12:00

Adding a schema for tables.

This commit is contained in:
mike12345567 2022-02-18 18:06:58 +00:00
parent 67bbba4747
commit 604bad89fd
4 changed files with 196 additions and 17 deletions

View file

@ -174,6 +174,42 @@
}
]
}
},
"table": {
"description": "The table to be created/updated.",
"type": "object",
"properties": {
"name": {
"description": "The name of the table",
"type": "string"
},
"schema": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"string",
"longform",
"options",
"number",
"boolean",
"array",
"datetime",
"attachment",
"link",
"formula",
"auto",
"json",
"internal"
]
}
}
}
}
}
}
}
},
@ -521,15 +557,29 @@
"/tables/search": {
"post": {
"summary": "Search internal and external tables based on their name.",
"tags": [
"tables"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"tags": [
"tables"
],
"requestBody": null,
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the table, this should be an exact match (ignoring case)."
}
}
}
}
}
},
"responses": {
"200": {
"description": "Returns the found tables, based on the search parameters.",
@ -555,14 +605,28 @@
"/tables": {
"post": {
"summary": "Create a new table.",
"tags": [
"tables"
],
"parameters": [
{
"$ref": "#/components/parameters/appId"
}
],
"tags": [
"tables"
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/table"
},
"examples": {
"table": {
"$ref": "#/components/examples/table"
}
}
}
}
},
"responses": {
"200": {
"description": "Returns the created table, including the ID which has been generated for it. This can be internal or external data sources.",
@ -627,6 +691,20 @@
"$ref": "#/components/parameters/appId"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/table"
},
"examples": {
"table": {
"$ref": "#/components/examples/table"
}
}
}
}
},
"responses": {
"200": {
"description": "Returns the updated table.",

View file

@ -116,6 +116,34 @@ components:
- type: integer
- type: array
- type: boolean
table:
description: The table to be created/updated.
type: object
properties:
name:
description: The name of the table
type: string
schema:
type: object
additionalProperties:
type: object
properties:
type:
type: string
enum:
- string
- longform
- options
- number
- boolean
- array
- datetime
- attachment
- link
- formula
- auto
- json
- internal
security:
- ApiKeyAuth: []
paths:
@ -340,11 +368,20 @@ paths:
/tables/search:
post:
summary: Search internal and external tables based on their name.
parameters:
- $ref: "#/components/parameters/appId"
tags:
- tables
requestBody: null
parameters:
- $ref: "#/components/parameters/appId"
requestBody:
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: The name of the table, this should be an exact match (ignoring
case).
responses:
"200":
description: Returns the found tables, based on the search parameters.
@ -360,10 +397,18 @@ paths:
/tables:
post:
summary: Create a new table.
parameters:
- $ref: "#/components/parameters/appId"
tags:
- tables
parameters:
- $ref: "#/components/parameters/appId"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/table"
examples:
table:
$ref: "#/components/examples/table"
responses:
"200":
description: Returns the created table, including the ID which has been
@ -400,6 +445,14 @@ paths:
parameters:
- $ref: "#/components/parameters/tableId"
- $ref: "#/components/parameters/appId"
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/table"
examples:
table:
$ref: "#/components/examples/table"
responses:
"200":
description: Returns the updated table.

View file

@ -1,3 +1,5 @@
const { FieldTypes } = require("../src/constants")
exports.row = {
description: "The row to be created/updated, based on the table schema.",
type: "object",
@ -11,3 +13,26 @@ exports.row = {
],
},
}
exports.table = {
description: "The table to be created/updated.",
type: "object",
properties: {
name: {
description: "The name of the table",
type: "string",
},
schema: {
type: "object",
additionalProperties: {
type: "object",
properties: {
type: {
type: "string",
enum: Object.values(FieldTypes),
},
},
},
},
},
}

View file

@ -8,12 +8,19 @@ const router = Router()
* /tables/search:
* post:
* summary: Search internal and external tables based on their name.
* parameters:
* - $ref: '#/components/parameters/appId'
* tags:
* - tables
* parameters:
* - $ref: '#/components/parameters/appId'
* requestBody:
*
* content:
* application/json:
* schema:
* type: object
* properties:
* name:
* type: string
* description: The name of the table, this should be an exact match (ignoring case).
* responses:
* 200:
* description: Returns the found tables, based on the search parameters.
@ -34,10 +41,18 @@ router.post("/tables/search", controller.search)
* /tables:
* post:
* summary: Create a new table.
* parameters:
* - $ref: '#/components/parameters/appId'
* tags:
* - tables
* parameters:
* - $ref: '#/components/parameters/appId'
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/table'
* examples:
* table:
* $ref: '#/components/examples/table'
* responses:
* 200:
* description: Returns the created table, including the ID which has been generated for it. This can be
@ -62,6 +77,14 @@ router.post("/tables", controller.create)
* parameters:
* - $ref: '#/components/parameters/tableId'
* - $ref: '#/components/parameters/appId'
* requestBody:
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/table'
* examples:
* table:
* $ref: '#/components/examples/table'
* responses:
* 200:
* description: Returns the updated table.