
* fix(e2e): update blocks e2e tests (#22010) * feat: preview content in an iframe (#22008) * feat: preview content * fix: pr suggestions * fix: pr suggestions * fix: iframe border * fix(content-manager): translate content-type and component attributes (#21951) * fix: review workflow persist data (#21984) * fix: review workflow persist data * fix: persist assignee * chore: comment * fix: typings and code simplification * Feat(cloud-cli): deploy command allows environment to be passed (#21898) * feat: deploy to env * chore: migrate media-library components to Typescript (#21622) * chore: migrate to TS AudoPreview component * chore: migrate to TS PaginationContext component * chore: migrate to TS Pagination component * chore: migrate to TS PaginationFolder components * chore: migrate to TS PaginationFooter index component * chore: migrate to TS isSelectable util * chore: migrate to TS PageSize component * chore: migrate to TS DialogFooter component * chore: migrate to TS Draggable component * chore: migrate to TS ContextInfo component * chore: migrate to TS ContextInfo test and index component * chore: migrate to TS PreviewBox components file * chore: migrate to TS DialogHeader component * chore: migrate to TS RemoveFolderDialog * chore: migrate to TS EmptyAssetGrid * chore: migrate to TS EmptyAssets index file * chore: migrate to TS AssetCardBase * chore: migrate to TS AudioAssetCard component * chore: migrate to TS DocAssetCard component * chore: migrate to TS ImageAssetCard component * chore: migrate to TS AssetCard unit tests * chore: migrate to TS SearchAsset component * chore: migrate to TS UploadProgress component * chore: migrate to TS FromComputerForm component * chore: migrate to TS FromUrlForm component * chore: migrate to TS AddAssetStep component * chore: migrate to TS VideoPreview component * chore: migrate to TS VideoAssetCard component * chore: migrate to TS UploadingAssetCard component * chore: migrate to TS PreviewCell component * chore: migrate to TS CellContent component * chore: migrate to TS TableRows component * chore: migrate to TS TableList component * chore: migrate to TS SortPicker component * chore: migrate to TS Option component with utils * chore: migrate to TS EmptyStateAsset and CarouselAsset * chore: migrate to TS CopyLinkButton component * chore: migrate to TS CarouselAssetActions component * chore: migrate to TS FolderGridList component * chore: migrate to TS FolderCardContext * chore: migrate to TS FolderCard component * chore: migrate to TS FolderCardBody component * chore: migrate to TS FolderCardBodyAction component * chore: migrate to TS FolderCardCheckbox component * chore: migrate to TS FolderCard unit test * chore: migrate to TS getFilterList * chore: migrate to TS FilterValueInput component * chore: migrate to TS FilterTag * chore: migrate to TS FilterList * chore: migrate to TS EditFolderModalHeader component * chore: migrate to TS AssetPreview component * chore: migrate to TS CroppingActions component * chore: migrate to TS RemoveAssetDialog component * chore: migrate to TS ReplaceMediaButton component * chore: migrate to TS AssetCard component * chore: migrate to TS AssetGridList * chore: migrate to TS PendingAssetStep component * chore: migrate to TS SelectedStep component * chore: migrate to TS PreviewBox component * chore: migrate to TS SelectTree * chore: migrate to TS SelectTree unit test * chore: migrate to TS BulkMoveDialog * chore: migrate to TS EditFolderContent component * chore: migrate to TS FilterValueInput * chore: migrato to TS CrumbSimpleMenuAsync * chore: migrate to TS Breadcrumbs * chore: migrate to TS Filters component * chore: migrate to TS EditAssetDialog * chore: migrate to TS CarouselAssets * chore: migrate to TS UploadAssetDialog and BrowseStep * chore: migrate to TS BrowseStep test * chore: migrate to TS AssetDialog component * chore: migrate to TS MediaLibraryDialog component * chore: migrate to TS MediaLibraryDialog component * chore: remove a useless type guard * chore: fix small stuff * chore: fix BulkMoveDialog unit test * chore: fix some types * chore: fix prettier problems * chore: fix review's comments * chore: fix review comments * chore: bump design system to 2.0.0-rc.12 (#22043) * chore: bump design system dep * fix: remove showBullet prop from Status components * chore: snapshot updates * feat(content-manager): integrate review workflows with releases (#21882) * feat(review-workflows): adding required stage for publishing (#21380) * feat(review-workflows): adding required stage for publishing * fix(review-workflows): fixs on rw required stage * fix(review-workflows): selected required stage when stage name changed * fix(review-workflows): bug when creating new rw * feat(review-workflows): check entry stage before publish (#21400) * feat(content-releases): add stage check to releases details page (#21497) * feat(content-releases): add stage check * fix(content-releases): apply suggestions on releases x review workflows * feat(content-releases): considered review stage when getting the action status (#21612) * feat(content-releases): considered review stage when getting the action status * fix: apply changes to reviewWorkflows on schema * fix: add api test for review workflows publish stage * fix: api tests * fix: validation message errors (#21878) * feat: add workflowId & hasRequiredStageToPublish to workflows metrics events (#21897) * fix(content-releases): skip flaky test * fix: update accessible name in history.spec.ts --------- * fix(e2e): enable e2e tests in editview.spec.ts (#21986) * fix: run discardDrafts without concurrency (#22074) * chore: config nx releases (#22087) * chore: dependency change * fix: revert release script * v5.3.0 --------- Co-authored-by: markkaylor <mark.kaylor@strapi.io> Co-authored-by: Gonzalo Andres Garcia <nouvellegon@gmail.com> Co-authored-by: Simone <startae14@gmail.com> Co-authored-by: Rémi de Juvigny <remi.dejuvigny@strapi.io> Co-authored-by: Rémi de Juvigny <8087692+remidej@users.noreply.github.com> Co-authored-by: Fernando Chávez <fernando.chavez@strapi.io> Co-authored-by: Ben Irvin <ben.irvin@strapi.io> Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>
Plugin documentation
This plugin automates your API documentation creation. It basically generates a swagger file. It follows the Open API specification version 3.0.1.
Usage
- Config
- Creating a new documentation version
- Generated files
- full_documentation.json structure
- Overriding the suggested documentation
- FAQ
- How does it generate the others plugins documentation ?
- I have created a route into a common API (like product) that query another model. How to automate this?
- TODO
Config
Create a settings.json
file located in src/extensions/documentation/config
folder where you can specify all your environment variables, licenses, external documentation and so one...
You can add all the entries listed in the specification.
NOTE if you need to add a custom key you can do it by prefixing your key by x-{something}
Creating a new documentation version
In order to create a new version you need to change the info.version
key in the settings.json
file.
This will automatically create a new version.
Generated files
When you start your server with this plugin installed it will automatically create the following files in your APIs (we will see how it works for the plugins).
- api
- my-api
- documentation
- documentationVersion // 1.0.0
- my-api.json // File containing all the identified path
- unclassified.json // File containing the manually added paths
- overrides // Folder to override the generated documentation
- documentationVersion // 1.0.0
- documentation
- my-api
- plugins
- ...
- documentation
- documentation
- 1.0.0
- full_documentation.json
- 1.0.0
- documentation
full_documentation.json
The combined documentation is merged into the full_documentation.json
file and it's located in src/extensions/documentation/documentation/{version}/full_documentation.json
It has the following structure
{
"openapi": "3.0.0", // do not change this version
"info": {
"version": "1.0.0" // change this line to create a new version
...
},
"x-strapi-config": {
"showGeneratedFiles": true // Do not change this line at the moment...
},
"servers": {}, // Your servers config (it will be automated)
"externalDocs": {},
"paths": {}, // All your Api routes
"tags": [], // Group of route
"components": {} // Default generated components and custom ones
}
Overriding the suggested documentation
Currently the plugin writes a json file for each API.
In order to customize the responses or to add information to a path you need to create a file in the associated overrides/<file-name>.json
(the name of the file matters so make sure they are similar). Then you just need to identify the path you want to modify.
You can modify the default generated tags by adding a new one at the end of the file. Same for the components.
NOTE 1
Overriding the full_documentation.json
is a bad idea since it will be regenerated each time you change a model.
NOTE 2
You can modify the tags
, paths
, and components
keys on the generated documentation by providing replacement values. You can see how the API is used in the users-permissions plugin: packages/plugins/users-permissions/server/register.js
FAQ
How does it generate the others plugins documentation ?
In other to reference a plugin's route into the documentation you need to add a description
key in the config
object.
For example this is the plugin email routes.json file
{
"routes": [
{
"method": "POST",
"path": "/",
"handler": "Email.send",
"config": {
"policies": [],
"description": "Send an email",
"tag": {
"plugin": "email",
"name": "Email"
}
}
},
{
"method": "GET",
"path": "/environments",
"handler": "Email.getEnvironments",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/settings/:environment",
"handler": "Email.getSettings",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/settings/:environment",
"handler": "Email.updateSettings",
"config": {
"policies": []
}
}
]
}
In this file we have only one route that we want to reference in our documentation (/
). Usually, the tag object is used for the SWAGGER UI, it will group this route under the Email - Email
dropdown in the documentation. Furthermore, the algorithm will try to find the model to generate the best response possible. If the model is unknown it generates a response like the following { foo: "string" }
that you can easily override later.
There's another property to guide the algorithm to create the best response possible, the actionType
key.
When we can't know by the controller name the type of the returned response (like find
and findOne
) you can specify it with this key. There's an example in ./plugins/users-permissions/config/routes.json
.
I have created a route in a common API (like product) that query another model. How to automate this ?
You can use the tag
key in your route. If you provide a tag
which is a string like "tag": "Product"
the algorithm will know that the end-point retrieves data from the Product
table. Creating a tag object { "tag": { "name": "User", "plugin": "User-Permissions } }
will result in generating a response with the User
model from the plugin users-permissions.
Each entry of the object is easily customisable take look at the users-permissions ones they are a good example on how to do it.