strapi-community / strapi-plugin-transformer

A plugin for Strapi Headless CMS that provides the ability to transform the API request or response.
https://market.strapi.io/plugins/strapi-plugin-transformer
MIT License
140 stars 22 forks source link

[FEAT] Transformations are not visible in Documentation plugin #100

Open SalahAdDin opened 6 months ago

SalahAdDin commented 6 months ago

We are using this plugin to avoid that much nestedness coming from Strapi 4.

It works fine.

When we want to work the API on Frontend we need the documentation plugin so we know what are we getting for any API request.

The problem is, that we don't see any changes done by the transformer in the documentation, image

Here is our configuration:

  transformer: {
    enabled: true,
    config: {
      responseTransforms: {
        removeAttributesKey: true,
        removeDataKey: true,
      },
      requestTransforms: {
        wrapBodyWithDataKey: true,
      },
    },
  },

Why?

wow64cpu commented 3 months ago

I have the same issue

The response body changes when interacting with the API, but in the generated Swagger specification the response body does not change. Because of this, it is impossible to directly configure the generation of client code, it remains to finish writing the generator, or to abandon the plugin

I tried changing the "plugins" field in the configuration, but it still doesn't work:

export default () => ({
  transformer: {
    enabled: true,
    config: {
      prefix: '/api/',
      responseTransforms: {
        removeAttributesKey: true,
        removeDataKey: true,
      },
      plugins: {
        ids: {
          documentation: true,
        },
        mode: 'allow'
      }
    }
  },
});

Versions: "@strapi/plugin-documentation": "^4.25.8" "strapi-plugin-transformer": "^3.1.2" "@strapi/strapi": "4.25.8"