Adding a schema for tables.
This commit is contained in:
parent
67bbba4747
commit
604bad89fd
|
@ -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": {
|
"/tables/search": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Search internal and external tables based on their name.",
|
"summary": "Search internal and external tables based on their name.",
|
||||||
|
"tags": [
|
||||||
|
"tables"
|
||||||
|
],
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"$ref": "#/components/parameters/appId"
|
"$ref": "#/components/parameters/appId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tags": [
|
"requestBody": {
|
||||||
"tables"
|
"content": {
|
||||||
],
|
"application/json": {
|
||||||
"requestBody": null,
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The name of the table, this should be an exact match (ignoring case)."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Returns the found tables, based on the search parameters.",
|
"description": "Returns the found tables, based on the search parameters.",
|
||||||
|
@ -555,14 +605,28 @@
|
||||||
"/tables": {
|
"/tables": {
|
||||||
"post": {
|
"post": {
|
||||||
"summary": "Create a new table.",
|
"summary": "Create a new table.",
|
||||||
|
"tags": [
|
||||||
|
"tables"
|
||||||
|
],
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"$ref": "#/components/parameters/appId"
|
"$ref": "#/components/parameters/appId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tags": [
|
"requestBody": {
|
||||||
"tables"
|
"content": {
|
||||||
],
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/table"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"table": {
|
||||||
|
"$ref": "#/components/examples/table"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Returns the created table, including the ID which has been generated for it. This can be internal or external data sources.",
|
"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"
|
"$ref": "#/components/parameters/appId"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/table"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"table": {
|
||||||
|
"$ref": "#/components/examples/table"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "Returns the updated table.",
|
"description": "Returns the updated table.",
|
||||||
|
|
|
@ -116,6 +116,34 @@ components:
|
||||||
- type: integer
|
- type: integer
|
||||||
- type: array
|
- type: array
|
||||||
- type: boolean
|
- 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:
|
security:
|
||||||
- ApiKeyAuth: []
|
- ApiKeyAuth: []
|
||||||
paths:
|
paths:
|
||||||
|
@ -340,11 +368,20 @@ paths:
|
||||||
/tables/search:
|
/tables/search:
|
||||||
post:
|
post:
|
||||||
summary: Search internal and external tables based on their name.
|
summary: Search internal and external tables based on their name.
|
||||||
parameters:
|
|
||||||
- $ref: "#/components/parameters/appId"
|
|
||||||
tags:
|
tags:
|
||||||
- tables
|
- 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:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Returns the found tables, based on the search parameters.
|
description: Returns the found tables, based on the search parameters.
|
||||||
|
@ -360,10 +397,18 @@ paths:
|
||||||
/tables:
|
/tables:
|
||||||
post:
|
post:
|
||||||
summary: Create a new table.
|
summary: Create a new table.
|
||||||
parameters:
|
|
||||||
- $ref: "#/components/parameters/appId"
|
|
||||||
tags:
|
tags:
|
||||||
- tables
|
- tables
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/appId"
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/table"
|
||||||
|
examples:
|
||||||
|
table:
|
||||||
|
$ref: "#/components/examples/table"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Returns the created table, including the ID which has been
|
description: Returns the created table, including the ID which has been
|
||||||
|
@ -400,6 +445,14 @@ paths:
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/components/parameters/tableId"
|
- $ref: "#/components/parameters/tableId"
|
||||||
- $ref: "#/components/parameters/appId"
|
- $ref: "#/components/parameters/appId"
|
||||||
|
requestBody:
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/table"
|
||||||
|
examples:
|
||||||
|
table:
|
||||||
|
$ref: "#/components/examples/table"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: Returns the updated table.
|
description: Returns the updated table.
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { FieldTypes } = require("../src/constants")
|
||||||
|
|
||||||
exports.row = {
|
exports.row = {
|
||||||
description: "The row to be created/updated, based on the table schema.",
|
description: "The row to be created/updated, based on the table schema.",
|
||||||
type: "object",
|
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),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
|
@ -8,12 +8,19 @@ const router = Router()
|
||||||
* /tables/search:
|
* /tables/search:
|
||||||
* post:
|
* post:
|
||||||
* summary: Search internal and external tables based on their name.
|
* summary: Search internal and external tables based on their name.
|
||||||
* parameters:
|
|
||||||
* - $ref: '#/components/parameters/appId'
|
|
||||||
* tags:
|
* tags:
|
||||||
* - tables
|
* - tables
|
||||||
|
* parameters:
|
||||||
|
* - $ref: '#/components/parameters/appId'
|
||||||
* requestBody:
|
* 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:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Returns the found tables, based on the search parameters.
|
* description: Returns the found tables, based on the search parameters.
|
||||||
|
@ -34,10 +41,18 @@ router.post("/tables/search", controller.search)
|
||||||
* /tables:
|
* /tables:
|
||||||
* post:
|
* post:
|
||||||
* summary: Create a new table.
|
* summary: Create a new table.
|
||||||
* parameters:
|
|
||||||
* - $ref: '#/components/parameters/appId'
|
|
||||||
* tags:
|
* tags:
|
||||||
* - tables
|
* - tables
|
||||||
|
* parameters:
|
||||||
|
* - $ref: '#/components/parameters/appId'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/table'
|
||||||
|
* examples:
|
||||||
|
* table:
|
||||||
|
* $ref: '#/components/examples/table'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Returns the created table, including the ID which has been generated for it. This can be
|
* 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:
|
* parameters:
|
||||||
* - $ref: '#/components/parameters/tableId'
|
* - $ref: '#/components/parameters/tableId'
|
||||||
* - $ref: '#/components/parameters/appId'
|
* - $ref: '#/components/parameters/appId'
|
||||||
|
* requestBody:
|
||||||
|
* content:
|
||||||
|
* application/json:
|
||||||
|
* schema:
|
||||||
|
* $ref: '#/components/schemas/table'
|
||||||
|
* examples:
|
||||||
|
* table:
|
||||||
|
* $ref: '#/components/examples/table'
|
||||||
* responses:
|
* responses:
|
||||||
* 200:
|
* 200:
|
||||||
* description: Returns the updated table.
|
* description: Returns the updated table.
|
||||||
|
|
Loading…
Reference in New Issue