Mockoon release v4.0.0

2023-07-24

Welcome to this new major release of Mockoon. It brings a lot of new features and improvements. The main focus of this release was to standardize the log format across all Mockoon applications and packages. We also took the opportunity to refactor the CLI to remove the PM2 dependency and make it more lightweight. Finally, we added a few new features and fixed some bugs.


 Our platinum sponsors

GitHub Localazy Peakcrypto

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

We introduced two breaking changes in this major release:

  • The logs format changed to be standardized across all Mockoon applications and packages. See the logs standardization section below for more details.
  • The CLI was refactored to remove the PM2 dependency and is now running as a foreground process by default. See the CLI section below for more details.

 Logs standardization and credentials filtering

Logging has been standardized across all Mockoon applications and packages. This means that the logs will now be formatted the same way in the desktop application log file, the CLI's console and log file, and the serverless package's console logging. This will make it easier to read and parse the logs. As part of this change, we also added a new setting to enable full transaction logging to both the desktop application and the serverless package. It is the equivalent of the CLI's --log-transaction flag.

Some events' logging formats changed. If you are using the logs in your scripts, you need update them to match the new format. The new format is the following:

Server start event:

  • Before:

    Copy
    { "level": "info", "message": "Server started on port 3000", "timestamp": "YYYY-MM-DDTHH:mm:ss.sssZ", "mockName": "mockoon-demo-api" }
  • After:

    Copy
    { "level": "info", "message": "Server started on port 3010", "timestamp": "YYYY-MM-DDTHH:mm:ss.sssZ", "app": "mockoon-server", "environmentName": "mockoon-demo-api", "environmentUUID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }

Transaction:

  • Before:

    Copy
    { "level": "info", "message": "GET /test | 200", "timestamp": "YYYY-MM-DDTHH:mm:ss.sssZ", "mockName": "mockoon-demo-api", "transaction": {...} }
  • After:

    Copy
    { "level": "info", "message": "Transaction recorded", "timestamp": "YYYY-MM-DDTHH:mm:ss.sssZ", "app": "mockoon-server", "environmentName": "mockoon-demo-api", "environmentUUID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "requestMethod": "GET", "requestPath": "/testheader", "requestProxied": false, "responseStatus": 200, "transaction": {...} }

(Issue #1063)

Finally, the new logging format automatically filters out credentials from the logs. It means that if you are using the --log-transaction flag or the full transaction logging settings, the authentication keys present in the Authorization or Proxy-Authorization headers are anonymized. (Issue #688)

 Desktop application

  • The logs are now formatted the same way as the CLI and the serverless package (JSON). See logs standardization section above for more details. (Issue #1063)

  • A new setting is available to enable full transaction logging. (Issue #1063)

enable full transaction logging in the settings dialog

  • A new context menu item is available to move an environment's data file to a new location without having to close and reopen it. (Issue #1062)

move environment file to a new folder

  • The id property used to manipulate data in single resource routes (GET /res/:id, PUT /res/:id, etc.) in a CRUD endpoint can now be set to something else like "uuid", "custom_id", etc. (Issue #1041)

    customize the crud id property

  • You can now search for routes in collapsed folders. (Issue #960)

 OpenAPI

  • A bug was fixed where OpenAPI export was crashing due to an incompatibility with CRUD routes. (Issue #1066)
  • When exporting to OpenAPI format, inline bodies are now used to populate the example property (Issue #352):
Copy
{ "paths": { "/test": { "get": { "responses": { "200": { "description": "", "content": { "application/json": { "example": "{\"response\": \"success\"}" } } } } } } } }

 Changes to templating helpers

  • The data and dataRaw helpers are now compatible with values coming from other helpers like queryParam. (Issues #1069)
  • We added a new boolean parameter to the oneOf helper to allow the user to stringify the result of the helper. (Issues #1074)
  • The faker helper is now compatible with Faker.js methods containing a number (internet.ipv4 and internet.ipv6). (Issues #1078)

 CLI

  • The logs format changed to match the desktop application and the serverless package. See logs standardization section above for more details. (Issue #1063)

  • We refactored the CLI to remove the dependency to PM2, which was subject to some security vulnerabilities. Another reason for this refactoring, was that, having multiple other ways to manage running CLI instances (i.e. containers), embedding a process manager felt a bit outdated and overkill. The CLI is now easier to maintain and more lightweight. As a consequence, the following changes were made:

    • The list and stop commands were removed together with the --pname flag which was used to customize PM2's process name.
    • The --daemon-off flag was removed and running the CLI as a foreground process is now the default. To run the CLI in the background, you can use the & operator in your terminal: mockoon-cli start -d ./data-file.json &.
    • The dockerize command was simplified and reduced to its core promise: it will now only generate the Dockerfile and copy (or download) the provided data files next to it. Head over to the CLI documentation for more details.

    (Issue #1081)

 Serverless package

  • The package now logs all events and transactions to stdout (console) in the same logging format used by the desktop application and the CLI. (Issues #1063 and #978)
  • A new option is available to enable full transaction logging. (Issue #1063)

 Thank you

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