From 96fa38f12c42cf417b9fb77dffc28e21486bb366 Mon Sep 17 00:00:00 2001 From: Thulio Prado Date: Wed, 30 Sep 2020 18:45:40 -0300 Subject: [PATCH] updates api specs --- packages/spec/specs/openapi.yaml | 21 ++--- packages/spec/specs/parameters/id.yaml | 4 +- packages/spec/specs/paths/auth/login.yaml | 7 +- packages/spec/specs/paths/auth/logout.yaml | 15 +++- .../specs/paths/auth/password-request.yaml | 4 - packages/spec/specs/paths/auth/refresh.yaml | 3 + .../spec/specs/paths/presets/presets.yaml | 21 ++--- packages/spec/specs/paths/scim/group.yaml | 51 ------------- packages/spec/specs/paths/scim/groups.yaml | 59 -------------- packages/spec/specs/paths/scim/user.yaml | 76 ------------------- packages/spec/specs/paths/scim/users.yaml | 59 -------------- 11 files changed, 40 insertions(+), 280 deletions(-) delete mode 100644 packages/spec/specs/paths/scim/group.yaml delete mode 100644 packages/spec/specs/paths/scim/groups.yaml delete mode 100644 packages/spec/specs/paths/scim/user.yaml delete mode 100644 packages/spec/specs/paths/scim/users.yaml diff --git a/packages/spec/specs/openapi.yaml b/packages/spec/specs/openapi.yaml index 5c0597253b..f56f5f7f03 100644 --- a/packages/spec/specs/openapi.yaml +++ b/packages/spec/specs/openapi.yaml @@ -1,17 +1,18 @@ openapi: 3.0.1 info: - title: Directus SDK + title: Directus API description: Template for generating any kind of SDK. contact: email: contact@directus.io license: name: GPL-3.0 url: "https://www.gnu.org/licenses/gpl-3.0.de.html" - version: 1.0.0 + version: 9.0.0 externalDocs: description: Directus Docs url: "https://docs.directus.io" servers: + - url: "http://localhost:41201/" - url: "https://demo.directus.io/" - url: "/" tags: @@ -21,8 +22,8 @@ tags: 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: Collection presets - description: Collection 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. + - 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. - 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. - name: Extensions @@ -71,7 +72,7 @@ paths: $ref: "./paths/activity/activity-comment.yaml" # Assets - /assets/{key}: + /assets/{id}: $ref: "./paths/assets/assets.yaml" # Authentication @@ -172,16 +173,6 @@ paths: /roles/{id}: $ref: "./paths/roles/role.yaml" - # SCIM - /scim/v2/Users: - $ref: "./paths/scim/users.yaml" - /scim/v2/Users/{id}: - $ref: "./paths/scim/user.yaml" - /scim/v2/Groups: - $ref: "./paths/scim/groups.yaml" - /scim/v2/Groups/{id}: - $ref: "./paths/scim/group.yaml" - # Server /server/info: $ref: "./paths/server/info.yaml" diff --git a/packages/spec/specs/parameters/id.yaml b/packages/spec/specs/parameters/id.yaml index ec7af1c934..ab577d31de 100644 --- a/packages/spec/specs/parameters/id.yaml +++ b/packages/spec/specs/parameters/id.yaml @@ -1,6 +1,6 @@ -description: Index of the file. +description: Index name: id in: path required: true schema: - type: integer \ No newline at end of file + type: integer diff --git a/packages/spec/specs/paths/auth/login.yaml b/packages/spec/specs/paths/auth/login.yaml index 7cdd4c4002..fc3aa301f8 100644 --- a/packages/spec/specs/paths/auth/login.yaml +++ b/packages/spec/specs/paths/auth/login.yaml @@ -21,8 +21,8 @@ post: example: password mode: type: string - enum: [jwt, cookie] - default: jwt + enum: ["json", cookie] + default: "json" description: Choose between retrieving the token as a string, or setting it as a cookie. otp: type: string @@ -44,3 +44,6 @@ post: expires: type: integer example: 900 + refresh_token: + type: string + example: yuOJkjdPXMd... diff --git a/packages/spec/specs/paths/auth/logout.yaml b/packages/spec/specs/paths/auth/logout.yaml index 120471a4f0..2beb4b14eb 100644 --- a/packages/spec/specs/paths/auth/logout.yaml +++ b/packages/spec/specs/paths/auth/logout.yaml @@ -3,6 +3,17 @@ post: tags: - Authentication operationId: logout + requestBody: + content: + application/json: + schema: + type: object + required: [token] + properties: + refresh_token: + type: string + example: eyJ0eXAiOiJKV... + description: JWT access token you want to logout. responses: - '200': - description: Request successful \ No newline at end of file + "200": + description: Request successful diff --git a/packages/spec/specs/paths/auth/password-request.yaml b/packages/spec/specs/paths/auth/password-request.yaml index 71637a4278..fbbceb9b0e 100644 --- a/packages/spec/specs/paths/auth/password-request.yaml +++ b/packages/spec/specs/paths/auth/password-request.yaml @@ -14,10 +14,6 @@ post: type: string example: admin@example.com description: Email address of the user you're requesting a reset for. - reset_url: - type: string - example: https://mydomain.com/passwordreset - description: Provide a custom reset url which the link in the Email will lead to. The reset token will be passed as a parameter. responses: "401": $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/auth/refresh.yaml b/packages/spec/specs/paths/auth/refresh.yaml index 3dcc7becf3..0f417f637c 100644 --- a/packages/spec/specs/paths/auth/refresh.yaml +++ b/packages/spec/specs/paths/auth/refresh.yaml @@ -31,5 +31,8 @@ post: expires: type: integer example: 900 + refresh_token: + type: string + example: Gy-caJMpmGTA... "401": $ref: "#/components/responses/UnauthorizedError" diff --git a/packages/spec/specs/paths/presets/presets.yaml b/packages/spec/specs/paths/presets/presets.yaml index fdb8923b98..5b0970a74c 100644 --- a/packages/spec/specs/paths/presets/presets.yaml +++ b/packages/spec/specs/paths/presets/presets.yaml @@ -53,9 +53,10 @@ post: description: Name for the bookmark. If this is set, the collection preset will be considered to be a bookmark. example: Highly rated articles role: - type: integer + type: string description: The unique identifier of a role in the platform. If user is null, this will be used to apply the collection preset or bookmark for all users in the role. - search_query: + example: null + search: type: string description: What the user searched for in search/filter in the header bar. filters: @@ -63,6 +64,9 @@ post: items: type: object properties: + key: + type: string + example: aHKLAakdVghzD field: type: string example: rating @@ -72,18 +76,15 @@ post: value: type: integer example: 4.5 - view_type: + layout: type: string - description: Name of the view type that is used. Defaults to tabular. - view_query: + description: Name of the view type that is used. + layout_query: type: string - description: View query that's saved per view type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. - view_options: + description: Layout query that's saved per layout type. Controls what data is fetched on load. These follow the same format as the JS SDK parameters. + layout_options: type: string description: Options of the views. The properties in here are controlled by the layout. - translation: - type: object - description: Key value pair of language-translation. Can be used to translate the bookmark title in multiple languages. responses: "200": description: Successful request diff --git a/packages/spec/specs/paths/scim/group.yaml b/packages/spec/specs/paths/scim/group.yaml deleted file mode 100644 index 238a8cafbc..0000000000 --- a/packages/spec/specs/paths/scim/group.yaml +++ /dev/null @@ -1,51 +0,0 @@ -get: - description: Retrieve a single SCIM Group by unique identifier. - operationId: getSCIMGroup - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -patch: - description: Update an existing SCIM Group - operationId: updateSCIMGroup - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -delete: - description: Delete an existing SCIM Group - operationId: deleteSCIMGroup - responses: - "200": - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -parameters: - - $ref: "#/components/parameters/Id" diff --git a/packages/spec/specs/paths/scim/groups.yaml b/packages/spec/specs/paths/scim/groups.yaml deleted file mode 100644 index 721a8f76d8..0000000000 --- a/packages/spec/specs/paths/scim/groups.yaml +++ /dev/null @@ -1,59 +0,0 @@ -get: - description: List the SCIM Groups. - operationId: getSCIMGroups - parameters: - - description: The 1-based index of the first result in the current set of list results. - in: query - name: startIndex - required: false - schema: - type: integer - - description: Specifies the desired maximum number of query results per page. - in: query - name: count - required: false - schema: - type: integer - - description: - Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq - 15` - in: query - name: filter - required: false - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -post: - description: Create a new SCIM Group. - operationId: createSCIMGroup - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM diff --git a/packages/spec/specs/paths/scim/user.yaml b/packages/spec/specs/paths/scim/user.yaml deleted file mode 100644 index c3d526d168..0000000000 --- a/packages/spec/specs/paths/scim/user.yaml +++ /dev/null @@ -1,76 +0,0 @@ -get: - description: Retrieve a single SCIM user by unique identifier. - operationId: getSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -patch: - description: Update an existing SCIM User - operationId: updateSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -delete: - description: Delete an existing SCIM User - operationId: deleteSCIMUser - parameters: - - description: - The `external_id` saved in `directus_users`. Corresponds to the `id` - in the SCIM Users endpoint result. - in: path - name: id - required: true - schema: - type: integer - responses: - "200": - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM diff --git a/packages/spec/specs/paths/scim/users.yaml b/packages/spec/specs/paths/scim/users.yaml deleted file mode 100644 index 9fb6b42afc..0000000000 --- a/packages/spec/specs/paths/scim/users.yaml +++ /dev/null @@ -1,59 +0,0 @@ -get: - description: List the SCIM users - operationId: getSCIMUsers - parameters: - - description: The 1-based index of the first result in the current set of list results. - in: query - name: startIndex - required: false - schema: - type: integer - - description: Specifies the desired maximum number of query results per page. - in: query - name: count - required: false - schema: - type: integer - - description: - Filter by `id`, `userName`, `emails.value` and `externalId` attributes - are supported. Only the `eq` operator is supported. Uses format `?filter=id eq - 15` - in: query - name: filter - required: false - schema: - type: integer - responses: - "200": - description: Successful request - content: - application/json: - schema: - type: object - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM -post: - description: Create a new SCIM User. - operationId: createSCIMUser - requestBody: - content: - application/json: - schema: - type: object - responses: - "200": - content: - application/json: - schema: - type: object - description: Successful request - "401": - $ref: "#/components/responses/UnauthorizedError" - "404": - $ref: "#/components/responses/NotFoundError" - tags: - - SCIM