diff --git a/openapi/components/parameters.yaml b/openapi/components/parameters.yaml index 53edd18..2307a00 100644 --- a/openapi/components/parameters.yaml +++ b/openapi/components/parameters.yaml @@ -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: >- diff --git a/openapi/paths/collections/createCollection.yaml b/openapi/paths/collections/createCollection.yaml index 45cc543..592fe19 100644 --- a/openapi/paths/collections/createCollection.yaml +++ b/openapi/paths/collections/createCollection.yaml @@ -8,6 +8,7 @@ description: | operationId: createCollection parameters: - $ref: ../../components/parameters.yaml#/Meta +- $ref: ../../components/parameters.yaml#/ConcurrentIndexCreation requestBody: content: application/json: diff --git a/openapi/paths/fields/_collection/_id/updateField.yaml b/openapi/paths/fields/_collection/_id/updateField.yaml index cba9f1b..43406aa 100644 --- a/openapi/paths/fields/_collection/_id/updateField.yaml +++ b/openapi/paths/fields/_collection/_id/updateField.yaml @@ -211,6 +211,7 @@ parameters: schema: type: string required: true +- $ref: ../../../../components/parameters.yaml#/ConcurrentIndexCreation x-codeSamples: - label: Directus SDK lang: JavaScript @@ -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: | diff --git a/openapi/paths/fields/_collection/createField.yaml b/openapi/paths/fields/_collection/createField.yaml index 678b792..ed1f123 100644 --- a/openapi/paths/fields/_collection/createField.yaml +++ b/openapi/paths/fields/_collection/createField.yaml @@ -210,6 +210,7 @@ parameters: required: true schema: type: string +- $ref: ../../../components/parameters.yaml#/ConcurrentIndexCreation x-codeSamples: - label: Directus SDK lang: JavaScript diff --git a/openapi/paths/fields/_collection/index.yaml b/openapi/paths/fields/_collection/index.yaml index 2f3bc20..8dd409b 100644 --- a/openapi/paths/fields/_collection/index.yaml +++ b/openapi/paths/fields/_collection/index.yaml @@ -2,3 +2,5 @@ get: $ref: getCollectionFields.yaml post: $ref: createField.yaml +patch: + $ref: updateFields.yaml \ No newline at end of file diff --git a/openapi/paths/fields/_collection/updateFields.yaml b/openapi/paths/fields/_collection/updateFields.yaml new file mode 100644 index 0000000..91d88e4 --- /dev/null +++ b/openapi/paths/fields/_collection/updateFields.yaml @@ -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 `: ` 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 + }