Skip to content

Commit

Permalink
Release 8.2.0
Browse files Browse the repository at this point in the history
Remove old docs
Add changelog and docs for new AI assistant and folder/route toggling.
  • Loading branch information
255kb committed Jun 3, 2024
1 parent 7ab135e commit f7bad6e
Show file tree
Hide file tree
Showing 357 changed files with 1,526 additions and 511 deletions.
18 changes: 0 additions & 18 deletions components/editors/xml-editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { xml } from '@codemirror/lang-xml';
import { linter } from '@codemirror/lint';
import { Text } from '@uiw/react-codemirror';
import { XMLValidator } from 'fast-xml-parser';
import { FunctionComponent } from 'react';
import BaseEditor from './base-editor';
Expand Down Expand Up @@ -28,23 +27,6 @@ const xmlLinter = linter(
{ delay: 100 }
);

function getErrorPosition(
error: SyntaxError,
doc: Text
): { line?: number; column?: number; position?: number } {
let match;
if ((match = error.message.match(/at position (\d+)/)))
return { position: Math.min(+match[1], doc.length) };
if ((match = error.message.match(/at line (\d+) column (\d+)/)))
return {
position: Math.min(doc.line(+match[1]).from + +match[2] - 1, doc.length)
};

return {
position: 1
};
}

const XmlEditor: FunctionComponent<{
value: string;
showValidMsg?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const Footer: FunctionComponent<{
</li>
<li className='mb-2'>
{/* Do not use <Link>, as routes with a dot inside get rewritten without trailing slash */}
<a href='/releases/8.1.1/' className='text-reset'>
<a href='/releases/8.2.0/' className='text-reset'>
Releases
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion components/nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ const Nav: FunctionComponent = function () {
Blog
</Link>
<a
href='/releases/8.1.1/'
href='/releases/8.2.0/'
className={`dropdown-item ${
router.pathname === '/releases' ||
router.pathname === '/releases/[version]'
Expand Down
6 changes: 3 additions & 3 deletions components/plans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const Plans: FunctionComponent<{ showFree: boolean; showTagline: boolean }> =
<p>
{pricing.SOLO.templatesQuota}{' '}
<Link href={'/ai-powered-api-mocking/'}>
AI-generated templates
AI-generated endpoints
</Link>{' '}
per month
</p>
Expand Down Expand Up @@ -506,7 +506,7 @@ const Plans: FunctionComponent<{ showFree: boolean; showTagline: boolean }> =
<p>
{pricing.TEAM.templatesQuota}{' '}
<Link href={'/ai-powered-api-mocking/'}>
AI-generated templates
AI-generated endpoints
</Link>{' '}
per month per seat
</p>
Expand Down Expand Up @@ -632,7 +632,7 @@ const Plans: FunctionComponent<{ showFree: boolean; showTagline: boolean }> =
<p>
{pricing.ENTERPRISE.templatesQuota}{' '}
<Link href={'/ai-powered-api-mocking/'}>
AI-generated templates
AI-generated endpoints
</Link>{' '}
per month per seat
</p>
Expand Down
2 changes: 1 addition & 1 deletion content/docs/latest/admin-api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In the desktop application, the admin API cannot be disabled. However, you can d
To **disable** the admin API when running your mock with the CLI, use the `--disable-admin-api` flag:

```bash
mockoon start --disable-admin-api -d ./mock.json
mockoon-cli start --disable-admin-api -d ./mock.json
```

> 📘 Check the [CLI dedicated documentation](https://github.com/mockoon/mockoon/tree/main/packages/cli#readme)
Expand Down
2 changes: 1 addition & 1 deletion content/docs/latest/api-endpoints/crud-routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A CRUD endpoint will automatically create a series of routes during runtime, all

To create a CRUD route, click on the "CRUD route" entry in the add route menu:

![Add a new CRUD route{440x304}](docs-img:add-crud-route.png)
![Add a new CRUD route{498x304}](docs-img:add-crud-route.png)

Then, set its path, usually a [resource name](/articles/api-guide-rest-api-components/#resource-url-request):

Expand Down
2 changes: 1 addition & 1 deletion content/docs/latest/api-endpoints/folders.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ order: 230

You can organize your routes into folders and sub-folders:

![routes organized in folders and sub-folders{849x518}](docs-img:routes-nested-folder.png)
![routes organized in folders and sub-folders{849x521}](docs-img:routes-nested-folder.png)

This new feature allows you to better organize your routes and make your APIs more readable and easier to navigate, with a clearer hierarchy.
You can drag and drop to move or reorganize your routes and folders.
Expand Down
12 changes: 12 additions & 0 deletions content/docs/latest/api-endpoints/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,15 @@ To pass arrays and objects in the query string of a request, you must use the fo

- for objects: `?param1=test&obj[prop1]=value`.
- for arrays: `?param1=test&array[]=value1&array[]=value2` or `?param1=test&array[0]=value1&array[1]=value2` or `?param1=test&array=value1,value2`.

### Temporarily disable a route

You can **disable a route** by clicking on the **Toggle route** entry in the route dropdown menu. The route will be marked with a red border and will not be accessible until you enable it again.

![disable route entry in the route dropdown menu{647x322}](docs-img:route-menu-disable-route.png)

You can also disable all routes in a folder by using the **Toggle direct child routes** entry in the folder dropdown menu.

When running your mock API using the [CLI](/cli/), you can [disable routes using the `--disable-routes` flag](https://github.com/mockoon/mockoon/tree/main/packages/cli#disabling-routes) followed by a route UUID or keyword/name or a folder keyword/name: `mockoon start --disable-routes myroute folder2`.

When using the [serverless package](/serverless/), you can [disable routes using the `disabledRoutes` option](https://github.com/mockoon/mockoon/tree/main/packages/serverless#disabling-routes).
2 changes: 1 addition & 1 deletion content/docs/latest/callbacks/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To create a new callback, open the **Callbacks** options by clicking on the tab

Add a new callback by clicking on the "plus" button:

![Add a new callback by clicking on the plus button{1484x578}](docs-img:add-callback.png)
![Add a new callback by clicking on the plus button{1484x576}](docs-img:add-callback.png)

## Configure a callback

Expand Down
2 changes: 1 addition & 1 deletion content/docs/latest/data-buckets/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To create a new data bucket, open the **Data** options by clicking on the tab at

Add a new data bucket by clicking on the "plus" button:

![Add a data bucket{1484x578}](docs-img:add-data-bucket.png)
![Add a data bucket{1484x576}](docs-img:add-data-bucket.png)

You can change the data bucket title and content on the right part of the screen.
Mockoon will automatically attribute a new **unique ID** to your data bucket. You can use this ID to reference the data using the [`data` helpers](docs:data-buckets/using-data-buckets#using-data-helpers). To retrieve a bucket's unique ID, look in the footer under the data bucket content or right-click on a bucket name in the list and click on "Copy ID to clipboard".
Expand Down
55 changes: 33 additions & 22 deletions content/docs/latest/mockoon-cloud/templates-and-ai-assistant.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,79 @@
---
title: Templates and AI assistant
title: AI assistants
meta:
title: Mockoon templates and AI assistant documentation
description: All you need to know about Mockoon's mock API ready to use JSON templates and AI assistant to generate your own dynamic and realistic templates.
title: Mockoon templates and AI assistants documentation
description: All you need to know about Mockoon's mock API ready to use JSON templates and AI assistants to generate your own dynamic and realistic templates.
order: 900
---

# Templates and AI assistant<span className='badge text-bg-warning fs-4 align-text-top ms-2'>PRO</span>
# Templates and AI assistants<span className='badge text-bg-warning fs-4 align-text-top ms-2'>PRO</span>

---

## Overview
## JSON templates assistant

Mockoon **templates** are pieces of JSON, often with [templating helpers](docs:templating/overview), that can be used in Mockoon to quickly prototype your mock APIs. They can be used in your [HTTP route's](docs:api-endpoints/routing#api-routes) body or as [data bucket](docs:data-buckets/overview) content to create realistic and dynamic data.

Two types of templates are available: **pre-generated** and **AI-generated**.

## Use the pre-generated templates
### Use the pre-generated templates

The pre-generated templates can be found in the desktop application.

To use a template in your routes, click on the "From template" entry in the route creation menu to open the templates dialog:
To use a template in your routes, click on the **"Assistants and templates"** entry in the route creation menu to open the templates dialog:

![modal with templates list{440x304}](docs-img:pre-generated-templates-modal.png)
![modal with templates list{498x304}](docs-img:pre-generated-templates-modal.png)

Then, select the template you want to use and either copy-paste its content manually or click on one of the two buttons to create a new **GET endpoint** or a **CRUD endpoint with a data bucket**.

![create get route from template{860x801}](docs-img:templates-create-get-route.png)

The "GET route" button will create a new HTTP GET route and copy the template content as the body. The "CRUD + data" button will create a new CRUD endpoint with a linked data bucket and copy the template content as the data bucket content.

> Starting with version 8.0.0 all the pre-generated templates are available for **free**.
> 💡 Starting with version 8.0.0 all the pre-generated templates are available for **free**.
## Use the AI assistant to generate realistic data
### Use the AI assistant to generate realistic templates

You can also use our AI assistant to generate realistic mock data for your various endpoints by providing a custom prompt. This feature is available in the desktop application and is part of the [Mockoon Pro](/pro/) plans.

To generate a new template, click the "From template" button in the route creation menu (see above), and select the "Generate" tab:
To generate a new template, click the **"Assistants and templates"** button in the route creation menu (see above), and select the "Generate JSON templates" tab:

![AI assistant generate tab{860x801}](docs-img:ai-assistant-generate-template-tab.png)

Then, write a prompt (e.g. "list of users") and click the "Generate" button.
Then, **write a prompt** (e.g. "list of users") and click the "Generate" button.

![AI assistant generate button click{860x801}](docs-img:ai-assistant-generate-button.png)

Finally, you can copy-paste the generated template manually or click on one of the two buttons to create a new **GET endpoint** or a **CRUD endpoint with a data bucket**.

![create get route from template{860x801}](docs-img:templates-generate-get-route.png)

### Writing prompts
### HTTP endpoints assistant

Mockoon AI assistant wraps your prompt with various instructions to help you generate the most relevant template for your needs. It has been optimized for the JSON format but can also generate templates in XML, CSV, etc.
Several options are available to fine-tune the generated templates:
A second AI assistant is available in the [Mockoon Pro](/pro/) plans to generate **realistic HTTP endpoints**. This feature works similarly to the JSON templates assistant but generates a full HTTP route with a **response body**, a **path**, a **method** and a **documentation**, based on your prompt.

- **JSON**: the generated template will be a valid JSON object.
- **array**: the generated template root level will be a JSON array (usually used with the **JSON** option).
- **templating**: the generated template will contain Handlebars [templating helpers](docs:templating/overview) (e.g. `{{faker 'person.firstName'}}`). Please note that disabling this option usually results in longer templates.
To generate a new HTTP endpoint, click the **"Assistants and templates"** button in the route creation menu (see above), and select the "Generate HTTP endpoints" tab:

![prompt options buttons{860x801}](docs-img:ai-assistant-template-generate-options.png)
![AI assistant generate endpoint tab{860x801}](docs-img:ai-assistant-generate-endpoint-tab.png)

Then, **write a prompt** (e.g. "Get a list of users") and click the "Generate" button.

![AI assistant generate endpoint button click{860x801}](docs-img:ai-assistant-generate-endpoint-button.png)

Finally, you can click on the **"Create HTTP route"** button to create a new endpoint from the generated data.

![create full route from generated result{860x801}](docs-img:ai-assistant-generate-endpoint-create-button.png)

## Writing prompts

Mockoon AI assistants wrap your prompt with various instructions to help you generate the most relevant JSON templates or endpoints for your needs. It will **infer the structure** of the JSON you want to generate from your prompt (e.g. single object, array, etc.). You can enable or disable the use of Handlebars [templating helpers](docs:templating/overview) (e.g. `{{faker 'person.firstName'}}`) using the option next to the "Generate" button.

![prompt templating option button{860x801}](docs-img:ai-assistant-template-generate-option.png)

You will obtain best results with shorter prompts: "list of users", "JSON configuration for library X", etc.

If you want more freedom when generating templates (using a different data format, etc.), you can disable the various options. Our system will still manage your prompt to increase the relevance of the generated template.
We put a lot of effort into making the AI assistants as accurate as possible, but it may not always generate the expected results. If you encounter any issues, please let us know by [contacting us](/contact/).

### AI assistant quota
## AI assistants quota

Each use of the AI assistant will count as one credit towards your monthly quota. You can check your quota in your [account page](/account/subscription/).
Each use of the AI assistants will count as one credit towards your monthly quota. You can check your quota in your [account page](/account/subscription/).
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Since [v1.16.0](https://github.com/mockoon/mockoon/releases/tag/v1.16.0), Mockoo

You can locate the folder in which the API data are stored by right-clicking on each environment and selecting **"Show data file in explorer/finder"**:

![click on show in folder in the context menu{515x346}](docs-img:environment-show-in-folder.png)
![click on show in folder in the context menu{547x349}](docs-img:environment-show-in-folder.png)

## Moving the files

You can move the data files to another folder by right-clicking on an environment and selecting **"Move data file to folder"**:

![click on Move data file to folder in folder in the context menu{515x377}](docs-img:environment-move-to-folder.png)
![click on Move data file to folder in folder in the context menu{547x380}](docs-img:environment-move-to-folder.png)

> 💡 Please note that the environment file will be copied to the new folder, and the original file will **not** be deleted. If you want to delete the original file, you will have to do it manually.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ order: 1120

To copy a specific environment or route's JSON data to the clipboard, right-click on the environment or route and select **Copy to clipboard (JSON)**:

![Right click on an environment and click on Copy to clipboard (JSON){715x365}](docs-img:export-clipboard-env.png)
![Right click on an environment and click on Copy to clipboard (JSON){747x368}](docs-img:export-clipboard-env.png)

The resulting JSON can be saved in a file and directly opened in the desktop app or used with the CLI.

Expand All @@ -30,6 +30,6 @@ You will be prompted to choose a save location for your new environment.

To create a new route from data present in the clipboard, open the **Routes** menu and select **Add route from clipboard**:

![Create new route from clipboard{802x289}](/images/docs/shared/new-environment-from-clipboard.png)
![Create new route from clipboard{802x289}](/images/docs/shared/new-route-from-clipboard.png)

The new route will be added to your active environment's routes.
2 changes: 1 addition & 1 deletion content/docs/latest/response-configuration/file-serving.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To serve a file, you must provide a path in the file input field:

You can either provide an absolute path like `/home/username/file.json` or a relative path. Starting with [v1.16.0](https://github.com/mockoon/mockoon/releases/tag/v1.16.0), relative paths are resolved from the environment's file location. You can check the environment's file location by right-clicking on an environment en select "Show in folder" in the contextual menu:

![show in folder menu entry{515x315}](docs-img:environment-show-in-folder.png)
![show in folder menu entry{547x349}](docs-img:environment-show-in-folder.png)

> 💡 Prior to v1.16.0, relative file paths were resolved from the application executable. This is also supported by the CLI since its version [1.2.0](https://github.com/mockoon/cli/releases/tag/v1.2.0).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Three parts are required to create a global route:

To create a global route, you first need to create a new HTTP route that will match all the endpoints you want to protect. To do so, create a new route and select "All methods" in the method dropdown:

![wildcard route on all methods{649x318}](docs-img:create-wildcard-route.png)
![wildcard route on all methods{649x337}](docs-img:create-wildcard-route.png)

In this example, the wildcard route is placed above the `GET /users` route, which is important as it will be [evaluated first](docs:api-endpoints/routing#routes-order) and catch all the requests. You can create it first or move it up in the routes list with a drag and drop.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ You can disable TLS when running your mock with the [CLI](/cli/) or the [serverl
To **disable** TLS when running your mock with the CLI, use the `--disable-tls` flag:

```bash
mockoon start --disable-tls -d ./mock.json
mockoon-cli start --disable-tls -d ./mock.json
```

> 📘 Check the [CLI dedicated documentation](https://github.com/mockoon/mockoon/tree/main/packages/cli#readme)
Expand Down
39 changes: 0 additions & 39 deletions content/docs/v5.0.0/server-configuration/serving-over-tls.md

This file was deleted.

Loading

0 comments on commit f7bad6e

Please sign in to comment.