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.
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!
We introduced two breaking changes in this major release:
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)
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)
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)
You can now search for routes in collapsed folders. (Issue #960)
example
property (Issue #352):Copy{ "paths": { "/test": { "get": { "responses": { "200": { "description": "", "content": { "application/json": { "example": "{\"response\": \"success\"}" } } } } } } } }
data
and dataRaw
helpers are now compatible with values coming from other helpers like queryParam
. (Issues #1069)oneOf
helper to allow the user to stringify the result of the helper. (Issues #1074)faker
helper is now compatible with Faker.js methods containing a number (internet.ipv4
and internet.ipv6
). (Issues #1078)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:
list
and stop
commands were removed together with the --pname
flag which was used to customize PM2's process name.--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 &
.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)
A big thank you to the following people who helped to make Mockoon better: