field, file, folder, permissions, relation and revision

This commit is contained in:
Thulio Prado
2020-09-28 19:31:46 -03:00
parent 882406df31
commit cef7975d58
6 changed files with 264 additions and 257 deletions

View File

@@ -1,10 +1,5 @@
type: object
properties:
id:
description: Unique identifier for the field in the `directus_fields` collection.
example: 167
type: integer
nullable: true
collection:
description: Unique name of the collection this field is in.
example: about_us
@@ -13,102 +8,161 @@ properties:
description: Unique name of the field. Field name is unique within the collection.
example: id
type: string
auto_increment:
description: If the value in this field is auto incremented. Only applies to integer
type fields.
example: true
type: boolean
datatype:
description: SQL datatype of the column that corresponds to this field.
example: INT
type: string
nullable: true
group:
description: What field group this field is part of.
example: null
type: integer
nullable: true
hidden_browse:
description: If this field should be hidden from the item browse (listing) page.
example: true
type: boolean
hidden_detail:
description: If this field should be hidden from the item detail (edit) page.
example: true
type: boolean
interface:
description: What interface is used in the admin app to edit the value for this
field.
example: primary-key
type: string
nullable: true
length:
description: Length of the field. Will be used in SQL to set the `length` property
of the colummn.
example: '10'
type: string
nullable: true
locked:
description: If the field can be altered by the end user. Directus system fields
have this value set to `true`.
example: true
type: boolean
note:
description: A user provided note for the field. Will be rendered alongside the
interface on the edit page.
example: ''
type: string
nullable: true
options:
description: Options for the interface that's used. This format is based on the
individual interface.
example: null
type: object
nullable: true
primary_key:
description: If this field is the primary key of the collection.
example: true
type: boolean
readonly:
description: Prevents the user from editing the value in the field.
example: false
type: boolean
required:
description: If this field requires a value.
example: true
type: boolean
signed:
description: If the value is signed or not. Only applies to integer type fields.
example: false
type: boolean
sort:
description: Sort order of this field on the edit page of the admin app.
example: 1
type: integer
nullable: true
translation:
description: 'Key value pair of `<locale>: <translation>` that allows the user
to change the displayed name of the field in the admin app.'
example: null
type: object
nullable: true
type:
description: Directus specific data type. Used to cast values in the API.
example: integer
type: string
unique:
description: If the value of this field should be unique within the collection.
example: false
type: boolean
validation:
description: User provided regex that will be used in the API to validate incoming
values. It uses the PHP flavor of RegEX.
example: null
type: string
schema:
description: The schema info.
type: object
properties:
name:
description: The name of the field.
example: title
type: string
table:
description: The collection of the field.
example: posts
type: string
type:
description: The type of the field.
example: string
type: string
default_value:
description: The default value of the field.
example: null
type: string
nullable: true
max_length:
description: The max length of the field.
example: null
type: integer
nullable: true
is_nullable:
description: If the field is nullable.
example: false
type: boolean
is_primary_key:
description: If the field is primary key.
example: false
type: boolean
has_auto_increment:
description: If the field has auto increment.
example: false
type: boolean
foreign_key_column:
description: Related column from the foreign key constraint.
example: null
type: string
nullable: true
foreign_key_table:
description: Related table from the foreign key constraint.
example: null
type: string
nullable: true
comment:
description: Comment as saved in the database.
example: null
type: string
nullable: true
schema:
description: Database schema (pg only).
example: public
type: string
foreign_key_schema:
description: Related schema from the foreign key constraint (pg only).
example: null
type: string
nullable: true
meta:
description: The meta info.
type: object
nullable: true
width:
description: Width of the field on the edit form.
example: null
type: string
nullable: true
enum: [half, half-left, half-right, full, fill, null]
properties:
id:
description: Unique identifier for the field in the `directus_fields` collection.
example: 3
type: integer
collection:
description: Unique name of the collection this field is in.
example: posts
type: string
field:
description: Unique name of the field. Field name is unique within the collection.
example: title
type: string
special:
description: Transformation flag for field
example: null
type: array
items:
type: string
nullable: true
interface:
description:
What interface is used in the admin app to edit the value for this
field.
example: primary-key
type: string
nullable: true
options:
description:
Options for the interface that's used. This format is based on the
individual interface.
example: null
type: object
nullable: true
display:
description: What display is used in the admin app to display the value for this field.
example: null
type: string
nullable: true
display_options:
description: Options for the display that's used. This format is based on the individual display.
example: null
type: object
nullable: true
locked:
description:
If the field can be altered by the end user. Directus system fields
have this value set to `true`.
example: true
type: boolean
readonly:
description: Prevents the user from editing the value in the field.
example: false
type: boolean
hidden:
description: If this field should be hidden.
example: true
type: boolean
sort:
description: Sort order of this field on the edit page of the admin app.
example: 1
type: integer
nullable: true
width:
description: Width of the field on the edit form.
example: null
type: string
nullable: true
enum: [half, half-left, half-right, full, fill, null]
group:
description: What field group this field is part of.
example: null
type: integer
nullable: true
translation:
description:
"Key value pair of `<locale>: <translation>` that allows the user
to change the displayed name of the field in the admin app."
example: null
type: object
nullable: true
note:
description:
A user provided note for the field. Will be rendered alongside the
interface on the edit page.
example: ""
type: string
nullable: true

View File

@@ -1,60 +1,71 @@
type: object
properties:
id:
description: Unique identifier for the file.
example: 8cbb43fe-4cdf-4991-8352-c461779cec02
type: string
storage:
description:
Where the file is stored. Either `local` for the local filesystem
or the name of the storage adapter (for example `s3`).
example: local
type: string
filename_disk:
description:
Name of the file on disk. By default, Directus uses a random hash
for the filename.
example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg
type: string
filename_download:
description: How you want to the file to be named when it's being downloaded.
example: avatar.jpg
type: string
title:
description:
Title for the file. Is extracted from the filename on upload, but
can be edited by the user.
example: User Avatar
type: string
type:
description: MIME type of the file.
example: image/jpeg
type: string
folder:
description: Virtual folder where this file resides in.
example: null
oneOf:
- type: string
- $ref: "../openapi.yaml#/components/schemas/Folder"
nullable: true
uploaded_by:
description: Who uploaded the file.
example: 63716273-0f29-4648-8a2a-2af2948f6f78
oneOf:
- type: string
- $ref: "../openapi.yaml#/components/schemas/User"
uploaded_on:
description: When the file was uploaded.
example: "2019-12-03T00:10:15+00:00"
type: string
format: date-time
charset:
description: Character set of the file.
example: binary
type: string
nullable: true # Should not be null?
checksum:
description: Represents the sum of the correct digits of the file, can be used
to detect errors in and duplicates of the file later.
example: d41d8cd98f00b204e9800998ecf8427e
type: string
data:
example:
embed: null
full_url: 'https://demo.directus.io/uploads/thumper/originals/a88c3b72-ac58-5436-a4ec-b2858531333a.jpg'
thumbnails:
dimension: 64x64
height: 64
relative_url: '/thumper/assets/pnw7s9lqy68048g0?key=directus-small-crop'
url: 'https://demo.directus.io/thumper/assets/pnw7s9lqy68048g0?key=directus-small-crop'
width: 64
url: '/uploads/thumper/originals/a88c3b72-ac58-5436-a4ec-b2858531333a.jpg'
properties:
full_url:
description: Full URL to the original file.
type: string
thumbnails:
description: List of all available asset sizes with links.
type: array
nullable: true
items:
type: object
properties:
dimension:
description: Width x height of the thumbnail.
type: string
height:
description: Height of the thumbnail in pixels.
type: integer
relative_url:
description: Relative URL to the thumbnail.
type: string
url:
description: Full URL to the thumbnail.
type: string
width:
description: Width of the thumbnail in pixels.
type: integer
url:
description: Relative URL to the original file.
type: string
type: object
description:
description: Description for the file.
example: ''
type: string
filesize:
description: Size of the file in bytes.
example: 137862
type: integer
width:
description: Width of the file in pixels. Only applies to images.
example: 800
type: integer
nullable: true
height:
description: Height of the file in pixels. Only applies to images.
example: 838
type: integer
nullable: true
duration:
description: Duration of the file in seconds. Only applies to audio and video.
@@ -66,82 +77,29 @@ properties:
example: null
type: string
nullable: true
filename_disk:
description: Name of the file on disk. By default, Directus uses a random hash
for the filename.
example: a88c3b72-ac58-5436-a4ec-b2858531333a.jpg
description:
description: Description for the file.
example: ""
type: string
filename_download:
description: How you want to the file to be named when it's being downloaded.
example: avatar.jpg
type: string
filesize:
description: Size of the file in bytes.
example: 137862
type: integer
folder:
description: Virtual folder where this file resides in.
example: null
$ref: '../openapi.yaml#/components/schemas/Folder'
nullable: true
height:
description: Height of the file in pixels. Only applies to images.
example: 838
type: integer
nullable: true
id:
description: Unique identifier for the file.
example: 8cbb43fe-4cdf-4991-8352-c461779cec02
type: string
location:
description: Where the file was created. Is automatically populated based on EXIF
description:
Where the file was created. Is automatically populated based on EXIF
data for images.
type: string
nullable: true
metadata:
description: User provided miscellaneous key value pairs that serve as additional
metadata for the file.
example: null
type: object
nullable: true
private_hash:
description: Random hash used to access the file privately. This can be rotated
to prevent unauthorized access to the file.
example: pnw7s9lqy68048g0
type: string
storage:
description: Where the file is stored. Either `local` for the local filesystem
or the name of the storage adapter (for example `s3`).
example: local
type: string
tags:
description: Tags for the file. Is automatically populated based on EXIF data
description:
Tags for the file. Is automatically populated based on EXIF data
for images.
type: array
nullable: true
items:
type: string
title:
description: Title for the file. Is extracted from the filename on upload, but
can be edited by the user.
example: User Avatar
type: string
type:
description: MIME type of the file.
example: image/jpeg
type: string
uploaded_by:
description: Who uploaded the file.
example: 63716273-0f29-4648-8a2a-2af2948f6f78
type: string
# $ref: '../openapi.yaml#/components/schemas/User'
uploaded_on:
description: When the file was uploaded.
example: '2019-12-03T00:10:15+00:00'
type: string
format: date-time
width:
description: Width of the file in pixels. Only applies to images.
example: 800
type: integer
nullable: true
metadata:
description:
User provided miscellaneous key value pairs that serve as additional
metadata for the file.
example: null
type: object
nullable: true

View File

@@ -11,5 +11,7 @@ properties:
parent_folder:
description: Unique identifier of the parent folder. This allows for nested folders.
example: null
type: string
nullable: true
oneOf:
- type: string
- $ref: "../openapi.yaml#/components/schemas/Folder"
nullable: true

View File

@@ -1,5 +1,14 @@
type: object
properties:
id:
description: Unique identifier for the permission.
example: 1
type: integer
role:
description: Unique identifier of the role this permission applies to.
example: 2f24211d-d928-469a-aea3-3c8f53d4e426
type: string
nullable: true # Should this be nullable?
collection:
description: What collection this permission applies to.
example: customers
@@ -24,10 +33,6 @@ properties:
example: none
type: string
enum: [none, create, update, always]
id:
description: Unique identifier for the permission.
example: 1
type: integer
read:
description: If the user can read items.
example: mine
@@ -39,11 +44,6 @@ properties:
type: array
items:
type: string
role:
description: Unique identifier of the role this permission applies to.
example: 2f24211d-d928-469a-aea3-3c8f53d4e426
type: string
nullable: true # Should this be nullable?
status:
description: What status this permission applies to.
example: null
@@ -67,4 +67,4 @@ properties:
example: []
type: array
items:
type: string
type: string

View File

@@ -1,5 +1,9 @@
type: object
properties:
id:
description: Unique identifier for the relation.
example: 1
type: integer
many_collection:
description: Collection that has the field that holds the foreign key.
example: directus_activity
@@ -25,13 +29,10 @@ properties:
description: The primary field.
example: id
type: string
id:
description: Unique identifier for the relation.
example: 1
type: integer
junction_field:
description: Field on the junction table that holds the primary key of the related
description:
Field on the junction table that holds the primary key of the related
collection.
example: null
type: string
nullable: true
nullable: true

View File

@@ -1,20 +1,30 @@
type: object
properties:
id:
description: Unique identifier for the revision.
example: 1
type: integer
activity:
description: Unique identifier for the [activity](/api/activity) record.
example: 2
type: integer
oneOf:
- type: integer
- $ref: "../openapi.yaml#/components/schemas/Activity"
collection:
description: Collection of the updated item.
example: articles
type: string
item:
description: Primary key of updated item.
example: "168"
type: string
data:
description: Copy of item state at time of update.
example:
author: 1
body: This is my first post
featured_image: 15
id: '168'
id: "168"
title: Hello, World!
type: object
nullable: true # Should this be nullable?
@@ -24,28 +34,10 @@ properties:
title: Hello, World!
oneOf:
- type: object
id:
description: Unique identifier for the revision.
example: 1
type: integer
item:
description: Primary key of updated item.
example: '168'
type: string
parent_changed:
description: If the current item was updated relationally, this shows if the parent
item was updated as well.
example: false
type: boolean
parent_collection:
description: If the current item was updated relationally, this is the collection
parent:
description:
If the current item was updated relationally, this is the collection
of the parent item.
example: null
type: string
nullable: true
parent_item:
description: If the current item was updated relationally, this is the unique
identifier of the parent item.
example: null
type: string
nullable: true