mirror of
https://github.com/directus/directus.git
synced 2026-02-10 10:05:23 -05:00
* Expose schema endpoints * respond with 204 * fix payload for export flag * allow export as YAML * use SchemaService * move getStringFromStream to utils * clearer exceptions with logs * check empty request body * specs * add bypassCache flag and remove flushCaches calls * Identify integer typed fields in Oracle * Fix uuid foreign keys type for Oracle * Detect autoincrement for CockroachDB * Bypass cache for fields and relations services * Add same DB tests * Test if working for all vendors * Add schema snapshot testing into sequential flow * Fix schema re-apply attempts when it's a different database vendor (#14816) * prevent diffing on certain properties * fix apply-snapshot test * prevent updates to autoincrement fields' schema * sanitize relations * remove `colleciton.schema.sql` parsing in test It is now being sanitized by `sanitizeCollection()` function in get-snapshot-diff.ts * Change concurrency group to not cancel test running on main * remove multipart for apply & add hash checking * check incoming version & add force query param * refine error message & stub for nested hash * add `vendor` top-level property as an additional safety net for cross db vendor applies * sanitize generated schema snapshots * snapshot joi validation * diff joi validation * minor cleanup * extract applyDiff & use deep-diff applyChange * use applyDiff in schema service * Mark vendor as optional * Update tests to apply diffs * move force flag check into service * Patch mssql vendor typo * Set relation no action in cyclic relations * Update mysql timestamp default value * Oracle cannot define no action * Update oracle timestamp type default values * add hash checking for outdated diffs * fix diff service & endpoint * Add hashes when returning after * Fix self referencing relations for Oracle * Add temp fix for CURRENT_TIMESTAMP defaults in Oracle * clean up driver and database client types * only require diff hash if not kind N * update hash comparison logic for create/delete * Set no action constraint for self referencing M2M in MSSQL * Add basic hash check tests * omit default value when hashing auto increments Specifically for CockroachDB with differing sequences * add vendor check * update specs * Validate vendors with type definition * Spread the vendors input array * re-add Export component * re-add js-yaml to root * Propagate mutation options for schema apply * Verify that snapshots differ and clear cache before hash tests * Fix unit test * Revert temp fix for CURRENT_TIMESTAMP defaults in Oracle * Define and reuse type for export format * Define and reuse list of database clients * change `were` to `was` * change `where` to `were` * add some empty lines for readability * tweak exception message * fix test * use object-hash * use boolean to check whether file is included * simplify request content type check * throw error when multiple files were uploaded * use nullish coalesce instead of short circuit * Update api/src/services/schema.ts Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com> * Remove unnecessary `Omit` on `SnapshotWithHash` type * Revert "Remove unnecessary `Omit` on `SnapshotWithHash` type" This reverts commitd22ac771ec. * check empty snapshot earlier * use allow-list logic via pick instead of omit * Update api/src/services/schema.ts Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch> * Move to own /schema endpoint controller * Fix refs to schema endpoint * move streamToString to utils package * move get-versioned-hash and add test * extract kind into an enum * Fix mysql5 timestamp value * Fix test collection existing on rerun * resolve TODO comment in blackbox test * Drop deep level hashes in diff These hashes are used only for more accurate error reporting but are otherwise superfluous, since changes are already detected by the top level hash. Therefore we remove them in favor of a simpler diff format and implementation. * Revert schema "fix" for createItem, add comment * Strict diff schema validation * Revert CrDB auto-increment detection patch in816c998* Clear systemCache to expose newly added fields * Use DiffKind constants * Extract diff & snapshot validation into own tested utils * Apply suggestions from @azrikahar * Update knex-schema-inspector to 3.0.1 Includes the fix for CrDB auto-increment detection (knex/knex-schema-inspector#135) * Update knex-schema-inspector in packages * Update lock file * add test for schema service * add test for export service * add relevant tests to modified util functions * fix csv test to account for os end of line * fix files controller test * dedupe test data for schema service * Align schema specs with docs * Update api/src/controllers/schema.ts * Revert testing for all vendors --------- Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com> Co-authored-by: ian <licitdev@gmail.com> Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
366 lines
10 KiB
YAML
366 lines
10 KiB
YAML
openapi: 3.0.1
|
|
info:
|
|
title: Directus
|
|
description: A real-time API and App dashboard for managing SQL database content.
|
|
contact:
|
|
email: contact@directus.io
|
|
license:
|
|
name: GPL-3.0
|
|
url: 'https://www.gnu.org/licenses/gpl-3.0.html'
|
|
version: 9.0.0
|
|
externalDocs:
|
|
description: Directus Docs
|
|
url: 'https://docs.directus.io'
|
|
tags:
|
|
- name: Activity
|
|
description:
|
|
All events that happen within Directus are tracked and stored in the activities collection. This gives you full
|
|
accountability over everything that happens.
|
|
x-collection: directus_activity
|
|
- name: Assets
|
|
description: Image typed files can be dynamically resized and transformed to fit any need.
|
|
- name: Authentication
|
|
description:
|
|
All events that happen within Directus are tracked and stored in the activities collection. This gives you full
|
|
accountability over everything that happens.
|
|
- name: Presets
|
|
description:
|
|
Presets hold the preferences of individual users of the platform. This allows Directus to show and maintain custom
|
|
item listings for users of the app.
|
|
x-collection: directus_presets
|
|
- name: Collections
|
|
description:
|
|
Collections are the individual collections of items, similar to tables in a database. Changes to collections will
|
|
alter the schema of the database.
|
|
x-collection: directus_collections
|
|
- name: Extensions
|
|
description:
|
|
Directus can easily be extended through the addition of several types of extensions, including layouts,
|
|
interfaces, and modules.
|
|
- name: Fields
|
|
description: Fields are individual pieces of content within an item. They are mapped to columns in the database.
|
|
x-collection: directus_fields
|
|
- name: Files
|
|
description:
|
|
Files can be saved in any given location. Directus has a powerful assets endpoint that can be used to generate
|
|
thumbnails for images on the fly.
|
|
x-collection: directus_files
|
|
- name: Flows
|
|
description: Flows enable custom, event-driven data processing and task automation.
|
|
x-collection: directus_flows
|
|
- name: Folders
|
|
description: Group files by virtual folders.
|
|
x-collection: directus_folders
|
|
- name: Items
|
|
description:
|
|
Items are individual pieces of data in your database. They can be anything, from articles, to IoT status checks.
|
|
- name: Operations
|
|
description: Operations are the building blocks within Data Flows.
|
|
x-collection: directus_operations
|
|
- name: Permissions
|
|
description: Permissions control who has access to what and when.
|
|
x-collection: directus_permissions
|
|
- name: Relations
|
|
description:
|
|
What data is linked to what other data. Allows you to assign authors to articles, products to sales, and whatever
|
|
other structures you can think of.
|
|
x-collection: directus_relations
|
|
- name: Revisions
|
|
description:
|
|
Revisions are individual changes to items made. Directus keeps track of changes made, so you're able to revert to
|
|
a previous state at will.
|
|
x-collection: directus_revisions
|
|
- name: Roles
|
|
description: Roles are groups of users that share permissions.
|
|
x-collection: directus_roles
|
|
- name: Schema
|
|
description: Retrieve and update the schema of an instance.
|
|
- name: Server
|
|
description:
|
|
Access to where Directus runs. Allows you to make sure your server has everything needed to run the platform, and
|
|
check what kind of latency we're dealing with.
|
|
- name: Settings
|
|
description: Settings control the way the platform works and acts.
|
|
x-collection: directus_settings
|
|
- name: Users
|
|
description: Users are what gives you access to the data.
|
|
x-collection: directus_users
|
|
- name: Utilities
|
|
description: Directus comes with various utility endpoints you can use to simplify your development flow.
|
|
- name: Webhooks
|
|
description: Webhooks.
|
|
x-collection: directus_webhooks
|
|
paths:
|
|
# Activity
|
|
/activity:
|
|
$ref: './paths/activity/activities.yaml'
|
|
/activity/comment:
|
|
$ref: './paths/activity/activity-comments.yaml'
|
|
/activity/{id}:
|
|
$ref: './paths/activity/activity.yaml'
|
|
/activity/comment/{id}:
|
|
$ref: './paths/activity/activity-comment.yaml'
|
|
|
|
# Assets
|
|
/assets/{id}:
|
|
$ref: './paths/assets/assets.yaml'
|
|
|
|
# Authentication
|
|
/auth/login:
|
|
$ref: './paths/auth/login.yaml'
|
|
/auth/refresh:
|
|
$ref: './paths/auth/refresh.yaml'
|
|
/auth/logout:
|
|
$ref: './paths/auth/logout.yaml'
|
|
/auth/password/request:
|
|
$ref: './paths/auth/password-request.yaml'
|
|
/auth/password/reset:
|
|
$ref: './paths/auth/password-reset.yaml'
|
|
/auth/oauth:
|
|
$ref: './paths/auth/oauth.yaml'
|
|
/auth/oauth/{provider}:
|
|
$ref: './paths/auth/oauth-provider.yaml'
|
|
|
|
# Items
|
|
/items/{collection}:
|
|
$ref: './paths/items/items.yaml'
|
|
/items/{collection}/{id}:
|
|
$ref: './paths/items/item.yaml'
|
|
|
|
# Presets
|
|
/presets:
|
|
$ref: './paths/presets/presets.yaml'
|
|
/presets/{id}:
|
|
$ref: './paths/presets/preset.yaml'
|
|
|
|
# Collections
|
|
/collections:
|
|
$ref: './paths/collections/collections.yaml'
|
|
/collections/{id}:
|
|
$ref: './paths/collections/collection.yaml'
|
|
|
|
# Extensions
|
|
/extensions/interfaces:
|
|
$ref: './paths/extensions/interfaces.yaml'
|
|
/extensions/layouts:
|
|
$ref: './paths/extensions/layouts.yaml'
|
|
/extensions/displays:
|
|
$ref: './paths/extensions/displays.yaml'
|
|
/extensions/modules:
|
|
$ref: './paths/extensions/modules.yaml'
|
|
|
|
# Fields
|
|
/fields:
|
|
$ref: './paths/fields/fields.yaml'
|
|
/fields/{collection}:
|
|
$ref: './paths/fields/collection-fields.yaml'
|
|
/fields/{collection}/{id}:
|
|
$ref: './paths/fields/collection-field.yaml'
|
|
|
|
# Files
|
|
/files:
|
|
$ref: './paths/files/files.yaml'
|
|
/files/{id}:
|
|
$ref: './paths/files/file.yaml'
|
|
|
|
# Flows
|
|
/flows:
|
|
$ref: './paths/flows/flows.yaml'
|
|
/flows/{id}:
|
|
$ref: './paths/flows/flow.yaml'
|
|
|
|
# Folders
|
|
/folders:
|
|
$ref: './paths/folders/folders.yaml'
|
|
/folders/{id}:
|
|
$ref: './paths/folders/folder.yaml'
|
|
|
|
# Operations
|
|
/operations:
|
|
$ref: './paths/operations/operations.yaml'
|
|
/operations/{id}:
|
|
$ref: './paths/operations/operation.yaml'
|
|
|
|
# Permissions
|
|
/permissions:
|
|
$ref: './paths/permissions/permissions.yaml'
|
|
/permissions/me:
|
|
$ref: './paths/permissions/permissions-me.yaml'
|
|
/permissions/{id}:
|
|
$ref: './paths/permissions/permission.yaml'
|
|
|
|
# Relations
|
|
/relations:
|
|
$ref: './paths/relations/relations.yaml'
|
|
/relations/{id}:
|
|
$ref: './paths/relations/relation.yaml'
|
|
|
|
# Revisions
|
|
/revisions:
|
|
$ref: './paths/revisions/revisions.yaml'
|
|
/revisions/{id}:
|
|
$ref: './paths/revisions/revision.yaml'
|
|
|
|
# Roles
|
|
/roles:
|
|
$ref: './paths/roles/roles.yaml'
|
|
/roles/{id}:
|
|
$ref: './paths/roles/role.yaml'
|
|
|
|
# Schema
|
|
/schema/snapshot:
|
|
$ref: './paths/schema/snapshot.yaml'
|
|
/schema/apply:
|
|
$ref: './paths/schema/apply.yaml'
|
|
/schema/diff:
|
|
$ref: './paths/schema/diff.yaml'
|
|
|
|
# Server
|
|
/server/info:
|
|
$ref: './paths/server/info.yaml'
|
|
/server/ping:
|
|
$ref: './paths/server/ping.yaml'
|
|
|
|
# Settings
|
|
/settings:
|
|
$ref: './paths/settings/settings.yaml'
|
|
|
|
# Users
|
|
/users:
|
|
$ref: './paths/users/users.yaml'
|
|
/users/{id}:
|
|
$ref: './paths/users/user.yaml'
|
|
/users/invite:
|
|
$ref: './paths/users/invite.yaml'
|
|
/users/invite/accept:
|
|
$ref: './paths/users/invite-accept.yaml'
|
|
/users/me:
|
|
$ref: './paths/users/me.yaml'
|
|
/users/me/track/page:
|
|
$ref: './paths/users/me-tracking.yaml'
|
|
/users/me/tfa/enable:
|
|
$ref: './paths/users/me-tfa-enable.yaml'
|
|
/users/me/tfa/disable:
|
|
$ref: './paths/users/me-tfa-disable.yaml'
|
|
|
|
# Utils
|
|
/utils/hash/generate:
|
|
$ref: './paths/utils/hash-generate.yaml'
|
|
/utils/hash/verify:
|
|
$ref: './paths/utils/hash-verify.yaml'
|
|
/utils/sort/{collection}:
|
|
$ref: './paths/utils/sort.yaml'
|
|
/utils/import/{collection}:
|
|
$ref: './paths/utils/import.yaml'
|
|
/utils/export/{collection}:
|
|
$ref: './paths/utils/export.yaml'
|
|
/utils/cache/clear:
|
|
$ref: './paths/utils/cache-clear.yaml'
|
|
/utils/random/string:
|
|
$ref: './paths/utils/random.yaml'
|
|
|
|
# Webhooks
|
|
/webhooks:
|
|
$ref: './paths/webhooks/webhooks.yaml'
|
|
/webhooks/{id}:
|
|
$ref: './paths/webhooks/webhook.yaml'
|
|
|
|
components:
|
|
schemas:
|
|
Activity:
|
|
$ref: './components/activity.yaml'
|
|
Presets:
|
|
$ref: './components/preset.yaml'
|
|
Collections:
|
|
$ref: './components/collection.yaml'
|
|
Diff:
|
|
$ref: './components/diff.yaml'
|
|
Fields:
|
|
$ref: './components/field.yaml'
|
|
Files:
|
|
$ref: './components/file.yaml'
|
|
Flows:
|
|
$ref: './components/flow.yaml'
|
|
Folders:
|
|
$ref: './components/folder.yaml'
|
|
Items:
|
|
$ref: './components/item.yaml'
|
|
Operations:
|
|
$ref: './components/operation.yaml'
|
|
Permissions:
|
|
$ref: './components/permissions.yaml'
|
|
Relations:
|
|
$ref: './components/relation.yaml'
|
|
Revisions:
|
|
$ref: './components/revision.yaml'
|
|
Roles:
|
|
$ref: './components/role.yaml'
|
|
Schema:
|
|
$ref: './components/schema.yaml'
|
|
Settings:
|
|
$ref: './components/setting.yaml'
|
|
Users:
|
|
$ref: './components/user.yaml'
|
|
Query:
|
|
$ref: './definitions/query.yaml'
|
|
Webhooks:
|
|
$ref: './components/webhook.yaml'
|
|
x-metadata:
|
|
type: object
|
|
properties:
|
|
total_count:
|
|
description: Returns the total item count of the collection you're querying.
|
|
type: integer
|
|
filter_count:
|
|
description:
|
|
Returns the item count of the collection you're querying, taking the current filter/search parameters into
|
|
account.
|
|
type: integer
|
|
parameters:
|
|
# All path parameters
|
|
Id:
|
|
$ref: './parameters/id.yaml'
|
|
UUId:
|
|
$ref: './parameters/uuid.yaml'
|
|
Collection:
|
|
$ref: './parameters/collection.yaml'
|
|
|
|
# All query parameters
|
|
Search:
|
|
$ref: './parameters/search.yaml'
|
|
Page:
|
|
$ref: './parameters/page.yaml'
|
|
Offset:
|
|
$ref: './parameters/offset.yaml'
|
|
Sort:
|
|
$ref: './parameters/sort.yaml'
|
|
Meta:
|
|
$ref: './parameters/meta.yaml'
|
|
Limit:
|
|
$ref: './parameters/limit.yaml'
|
|
Filter:
|
|
$ref: './parameters/filter.yaml'
|
|
Fields:
|
|
$ref: './parameters/fields.yaml'
|
|
Mode:
|
|
$ref: './parameters/mode.yaml'
|
|
Export:
|
|
$ref: './parameters/export.yaml'
|
|
responses:
|
|
NotFoundError:
|
|
$ref: './responses/notFoundError.yaml'
|
|
UnauthorizedError:
|
|
$ref: './responses/unauthorizedError.yaml'
|
|
securitySchemes:
|
|
KeyAuth:
|
|
type: apiKey
|
|
in: query
|
|
name: access_token
|
|
Auth:
|
|
type: apiKey
|
|
in: header
|
|
name: 'Authorization'
|
|
security:
|
|
- Auth: []
|
|
- KeyAuth: []
|