2024-10-25
Welcome to this new major release of Mockoon. It brings tons of new exciting features: WebSocket support, new rules and operators, file upload metadata, CRUD ids auto-increment, new templating helpers, new endpoints for the admin API, and many more improvements and fixes. Read on to learn more about this release.
Mockoon is an open-source project built by volunteer maintainers. If you like our application, please consider sponsoring us and join all the Sponsors and Backers who helped this project over time!
Many new features were added (new rule types, new WebSocket routes, etc.) which resulted in modifications of the data files schema. If you are using your data files with the CLI or serverless package, or if you are sharing your setup with your team, we recommend you migrate every application to the new version at the same time to avoid any compatibility issues.
Note for teams using our Cloud: We recommend that all team members update their application to the new version at the same time to ensure a smooth transition (more information). API deployed in our Cloud instances will continue running following the old schema (v8) until they are redeployed (more information).
We updated the libraries and application dependencies to their latest versions. The most notable change is the migration to Faker.js version 9, which includes numerous function removals and some modifications to signatures and parameters. However, this should have minimal impact on your templates, as most functions were already deprecated in version 8 and have been automatically migrated to the new syntax (see Faker.js v9 migration guide).
We are excited to announce that Mockoon now supports WebSockets. You can create multiple WebSocket routes on different paths in each API and define the messages that will be sent using templating and rules:
The WebSocket feature also supports broadcasting that allows you to send a message to the connected clients at a specified interval:
Websockets support most of Mockoon's existing features: route parameters, cookies, templating helpers, rules, etc. Head over to the WebSockets documentation to learn more about this feature.
Mutiple improvements have been made to the templating rules system:
The presence indicator for the real-time collaboration feature has been improved to show the active team members but also the current environment they are working on:
(Issue #1512)
We added support for storing the uploaded file's metadata (filename
, mimetype
, size
) for multipart form data requests. While Mockoon is still not storing any uploaded files, this change will make simulating a file server easier. Combine with this technique it becomes possible to simulate an upload and then serve the file back.
Head over to the body helper documentation to learn more about this feature.
(Issue #1445)
Until now, CRUD routes' ids were UUIDs generated during object creations (POST /resources
) if none was provided. CRUD routes now supports auto-incremented ids. If the data bucket array contain at least one object with a numeric id
(or a custom property), the CRUD route will automatically increment the id of the new objects created.
(Issue #1542)
setData
helper that allows you to manipulate your data buckets from anywhere. You can set, push, increment, decrement, invert. This will allow for more complex templating scenarios: authentication, feature flags, etc. (Issue #1098)isValidDate
helper. (Issue #1510)uuid
helper alias of {{faker 'string.uuid'}}
. (Issue #1533)filter
helper is now compatible with nested objects. (Issue #1123)filter
, eq
and stringify
helpers are now compatible with SafeStrings and can therefore accept content from any helper including the ones sanitized by Handlebars. (Issues #1489 and #1529)Multiple new endpoints have been added to the admin API:
GET /mockoon-admin/env-vars/:key
to get the value of an environment variable (documentation).GET /mockoon-admin/global-vars/:key
to get the value of a global variable (documentation).GET /mockoon-admin/data-buckets/:key
to get the current value of a data bucket (documentation).(Issue #1557)
The number of responses is now displayed next to the currently selected response:
(Issue #1528)
PUT /resources/:id
), this is now fixed. (Issue #1548)A big thank you to the following people who helped to make Mockoon better: