Mockoon release v9.0.0

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.


 Our sponsors

GitHub Localazy

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!

sponsor button


 ⚠️ Breaking changes

  • 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).

 WebSocket support

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:

Add a new websocket route

The WebSocket feature also supports broadcasting that allows you to send a message to the connected clients at a specified interval:

toggle the broadcasting mode

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.

(Issues #83 and #1495)

 New rules and operators

Mutiple improvements have been made to the templating rules system:

 Better team collaboration presence indicators (Cloud)

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:

team collaboration presence indicator showing multiple user working

(Issue #1512)

 File upload metadata

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)

 CRUD ids auto-increment

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.

Documentation

(Issue #1542)

 Templating helpers

  • We added a new 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)
  • We added a new isValidDate helper. (Issue #1510)
  • We added a new uuid helper alias of {{faker 'string.uuid'}}. (Issue #1533)
  • The filter helper is now compatible with nested objects. (Issue #1123)
  • The 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)

 Admin API new endpoints

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)

 Small UI improvement

The number of responses is now displayed next to the currently selected response:

number of responses displayed next to the selected response in a badge

(Issue #1528)

 Fixes

  • We sanitized the helpers supporting a JSONPath to prevent RCE vulnerabilities. (Issue #1551)
  • Custom ids were not kept in CRUD routes when updating by id (PUT /resources/:id), this is now fixed. (Issue #1548)
  • We fixed an issue where deactivated inputs in the rules interface were not staying deactivated after navigating to another view. (Issue #1517)
  • When navigating from a CRUD route secondary response to the primary response, while being on a tab not available on the primary response, the UI stayed on the tab. This is now fixed. (Issue #1552)

 Chores

  • We renewed the Windows Code Signing certificate and migrated to Azure Trusted Signing. (Issue #1514)
  • We renewed the Apple Code Signing certificates. (Issue #1513)
  • [⚠️ Potential breaking change for your templates] We updated the libraries and applications dependencies to their latest versions to fix some reported vulnerabilities (notably the JSONPath CVE). As a result, we also migrated to Faker.js version 9 (see Faker.js v9 migration guide). (Issue #1562)

 Thank you

A big thank you to the following people who helped to make Mockoon better: