Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions openapi/components/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ Version:
required: false
schema:
type: string
ConcurrentIndexCreation:
name: concurrentIndexCreation
description: Attempts to concurrently create a field index if supported
in: query
required: false
schema:
type: boolean
default: false
Backlink:
name: backlink
description: >-
Expand Down
1 change: 1 addition & 0 deletions openapi/paths/collections/createCollection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description: |
operationId: createCollection
parameters:
- $ref: ../../components/parameters.yaml#/Meta
- $ref: ../../components/parameters.yaml#/ConcurrentIndexCreation
requestBody:
content:
application/json:
Expand Down
3 changes: 2 additions & 1 deletion openapi/paths/fields/_collection/_id/updateField.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ parameters:
schema:
type: string
required: true
- $ref: ../../../../components/parameters.yaml#/ConcurrentIndexCreation
x-codeSamples:
- label: Directus SDK
lang: JavaScript
Expand All @@ -219,7 +220,7 @@ x-codeSamples:

const client = createDirectus('directus_project_url').with(rest());

const result = await client.request(updateField(collection_name, field_name, partial_field_object));
const result = await client.request(updateField(collection_name, partial_field_object));
- label: GraphQL
lang: GraphQL
source: |
Expand Down
1 change: 1 addition & 0 deletions openapi/paths/fields/_collection/createField.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ parameters:
required: true
schema:
type: string
- $ref: ../../../components/parameters.yaml#/ConcurrentIndexCreation
x-codeSamples:
- label: Directus SDK
lang: JavaScript
Expand Down
2 changes: 2 additions & 0 deletions openapi/paths/fields/_collection/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ get:
$ref: getCollectionFields.yaml
post:
$ref: createField.yaml
patch:
$ref: updateFields.yaml
227 changes: 227 additions & 0 deletions openapi/paths/fields/_collection/updateFields.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
summary: Update multiple Fields
description: Updates the given fields in the given collection.
operationId: updateFields
requestBody:
content:
application/json:
schema:
type: array
items:
type: object
properties:
type:
description: Directus specific data type. Used to cast values in the API.
example: integer
type: string
field:
type: string
description: Unique name of the field. Field name is unique within the
collection.
example: id
schema:
type: object
description: The schema info.
properties:
type:
description: The type of the field.
example: string
type: string
name:
type: string
description: The name of the field.
example: title
table:
type: string
description: The collection of the field.
example: posts
default_value:
type: string
description: The default value of the field.
example:
nullable: true
max_length:
type: integer
description: The max length of the field.
example:
nullable: true
is_nullable:
type: boolean
description: If the field is nullable.
example: false
is_primary_key:
type: boolean
description: If the field is primary key.
example: false
has_auto_increment:
type: boolean
description: If the field has auto increment.
example: false
foreign_key_column:
type: string
description: Related column from the foreign key constraint.
example:
nullable: true
foreign_key_table:
type: string
description: Related table from the foreign key constraint.
example:
nullable: true
comment:
type: string
description: Comment as saved in the database.
example:
nullable: true
schema:
type: string
description: Database schema (pg only).
example: public
foreign_key_schema:
type: string
description: Related schema from the foreign key constraint (pg only).
example:
nullable: true
meta:
type: object
description: The meta info.
nullable: true
properties:
id:
type: integer
description: Unique identifier for the field in the `directus_fields`
collection.
example: 3
collection:
type: string
description: Unique name of the collection this field is in.
example: posts
field:
type: string
description: Unique name of the field. Field name is unique within
the collection.
example: title
special:
type: array
description: Transformation flag for field
example:
items:
type: string
nullable: true
system-interface:
type: string
description: What interface is used in the admin app to edit the value
for this field.
example: primary-key
nullable: true
options:
type: object
description: Options for the interface that's used. This format is
based on the individual interface.
example:
nullable: true
display:
type: string
description: What display is used in the admin app to display the
value for this field.
example:
nullable: true
display_options:
type: object
description: Options for the display that's used. This format is based
on the individual display.
example:
nullable: true
locked:
type: boolean
description: If the field can be altered by the end user. Directus
system fields have this value set to `true`.
example: true
readonly:
type: boolean
description: Prevents the user from editing the value in the field.
example: false
required:
type: boolean
description: If this field should be required.
example: false
hidden:
type: boolean
description: If this field should be hidden.
example: true
sort:
type: integer
description: Sort order of this field on the edit page of the admin
app.
example: 1
nullable: true
width:
type: string
description: Width of the field on the edit form.
example:
nullable: true
enum:
- half
- half-left
- half-right
- full
- fill
-
group:
type: integer
description: What field group this field is part of.
example:
nullable: true
translation:
type: object
description: 'Key value pair of `<language>: <translation>` that allows
the user to change the displayed name of the field in the admin
app.'
example:
nullable: true
note:
type: string
description: A user provided note for the field. Will be rendered
alongside the interface on the edit page.
example: ''
nullable: true
responses:
'200':
description: Successful request
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: ../../../components/schemas/fields.yaml
'401':
$ref: ../../../components/responses.yaml#/UnauthorizedError
'404':
$ref: ../../../components/responses.yaml#/NotFoundError
security: []
tags:
- Fields
parameters:
- name: collection
in: path
description: Unique identifier of the collection the item resides in.
schema:
type: string
required: true
- $ref: ../../../components/parameters.yaml#/ConcurrentIndexCreation
x-codeSamples:
- label: Directus SDK
lang: JavaScript
source: |
import { createDirectus, rest, updateFields } from '@directus/sdk';

const client = createDirectus('directus_project_url').with(rest());

const result = await client.request(updateFields(collection_name, partial_field_array));
- label: GraphQL
lang: GraphQL
source: |
type Mutation {
update_fields_item(collection: String!, data: update_directus_fields_input!): directus_fields
}