From 5395e3c7e5cb8f37ffd029c8714549f61aaf4b21 Mon Sep 17 00:00:00 2001 From: Gerard Lamusse Date: Fri, 23 Aug 2024 09:58:24 +0200 Subject: [PATCH 1/2] Separate schema needed for operations from schema used to generate api spec (#23460) Co-authored-by: Pascal Jufer --- .changeset/tiny-jeans-matter.md | 5 +++++ api/src/services/specifications.ts | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 .changeset/tiny-jeans-matter.md diff --git a/.changeset/tiny-jeans-matter.md b/.changeset/tiny-jeans-matter.md new file mode 100644 index 0000000000..085b9cb58d --- /dev/null +++ b/.changeset/tiny-jeans-matter.md @@ -0,0 +1,5 @@ +--- +"@directus/api": patch +--- + +Fixed the generated OpenAPI specs to include POST, PATCH and DELETE paths again diff --git a/api/src/services/specifications.ts b/api/src/services/specifications.ts index f5616f4be2..f31c9006cf 100644 --- a/api/src/services/specifications.ts +++ b/api/src/services/specifications.ts @@ -61,7 +61,7 @@ class OASSpecsService implements SpecificationSubService { } async generate(host?: string) { - let schema = this.schema; + let schemaForSpec = this.schema; let permissions: Permission[] = []; if (this.accountability && this.accountability.admin !== true) { @@ -70,22 +70,22 @@ class OASSpecsService implements SpecificationSubService { accountability: this.accountability, action: 'read', }, - { schema, knex: this.knex }, + { schema: this.schema, knex: this.knex }, ); - schema = reduceSchema(schema, allowedFields); + schemaForSpec = reduceSchema(this.schema, allowedFields); - const policies = await fetchPolicies(this.accountability, { schema, knex: this.knex }); + const policies = await fetchPolicies(this.accountability, { schema: this.schema, knex: this.knex }); permissions = await fetchPermissions( - { action: 'read', policies, accountability: this.accountability }, - { schema, knex: this.knex }, + { policies, accountability: this.accountability }, + { schema: this.schema, knex: this.knex }, ); } - const tags = await this.generateTags(schema); + const tags = await this.generateTags(schemaForSpec); const paths = await this.generatePaths(permissions, tags); - const components = await this.generateComponents(schema, tags); + const components = await this.generateComponents(schemaForSpec, tags); const isDefaultPublicUrl = env['PUBLIC_URL'] === '/'; const url = isDefaultPublicUrl && host ? host : (env['PUBLIC_URL'] as string); From 103a4c96e4dbbe008841ed82eea2fcee7385ac22 Mon Sep 17 00:00:00 2001 From: Fatuma Abdullahi <67555014+FatumaA@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:05:50 +0300 Subject: [PATCH 2/2] fix: update good first issue link (#23464) Co-authored-by: Pascal Jufer --- contributors.yml | 1 + docs/contributing/pull-request-process.md | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contributors.yml b/contributors.yml index 64b4faba7e..720bc9c9f6 100644 --- a/contributors.yml +++ b/contributors.yml @@ -156,3 +156,4 @@ - maxbritto - tennox - maxsteinwand +- FatumaA diff --git a/docs/contributing/pull-request-process.md b/docs/contributing/pull-request-process.md index 238f9c56b6..a2c3f6ac54 100644 --- a/docs/contributing/pull-request-process.md +++ b/docs/contributing/pull-request-process.md @@ -16,9 +16,9 @@ accidentally work on the same issue at the same time. ## Choosing What to Implement We welcome PRs for any open [Issue](https://github.com/directus/directus/issues). Issues labeled -["Good First Issue"](https://github.com/directus/directus/issues?q=is:issue+is:open+label:%22Good+First+Issue%22) are -typically easier to resolve for those who haven't contributed to the codebase before, and are therefore a great starting -point. +["Good First Issue"](https://github.com/directus/directus/issues?q=is:issue+is:open+label:%22:star:+Good+First+Issue%22) +are typically easier to resolve for those who haven't contributed to the codebase before, and are therefore a great +starting point. ## Implementing an Accepted Feature Request