Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
515c034
fix(release): fix NPM release buidl
marle3003 Feb 18, 2026
3c444df
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 18, 2026
17d4601
build(deps): bump github.com/blevesearch/bleve_index_api
dependabot[bot] Feb 20, 2026
e5a8291
build(deps): bump @types/mokapi from 0.29.1 to 0.34.0 in /webui
dependabot[bot] Feb 20, 2026
dd7fb4f
Merge pull request #853 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Feb 20, 2026
c8327e2
build(deps): bump @types/nodemailer from 7.0.9 to 7.0.10 in /webui
dependabot[bot] Feb 20, 2026
efae00d
Merge pull request #851 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Feb 20, 2026
7d0e3a5
build(deps-dev): bump @vue/eslint-config-typescript in /webui
dependabot[bot] Feb 20, 2026
dbcfccc
Merge pull request #852 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Feb 20, 2026
1b3ac50
build(deps-dev): bump @rushstack/eslint-patch in /webui
dependabot[bot] Feb 20, 2026
3e53fe8
Merge pull request #850 from marle3003/dependabot/npm_and_yarn/webui/…
github-actions[bot] Feb 20, 2026
53c03a4
fix(webui): fix grid layout
marle3003 Feb 22, 2026
a2edf29
doc: add kafka example for get-started tutorial
marle3003 Feb 22, 2026
192af2a
doc: add kafka example for get-started tutorial
marle3003 Feb 22, 2026
bd56662
feat(webui): add support for image caption
marle3003 Feb 22, 2026
30de680
doc: add OpenAPI tag
marle3003 Feb 22, 2026
79859af
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 22, 2026
d5f9f74
doc: update documentation for get-started kafka
marle3003 Feb 22, 2026
e980cf9
feat(webui): enable responsive tables in documentations
marle3003 Feb 23, 2026
039de72
feat(javascript): allow providing a function to set whether handler s…
marle3003 Feb 23, 2026
ee0a778
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 23, 2026
0ca9920
feat(javascript): use default value if parameter is not present in HT…
marle3003 Feb 23, 2026
239fecd
fix(swagger): add missing parameter attribute to conversion
marle3003 Feb 23, 2026
b5b433a
feat(webui): improve displaying HTTP event request parameters
marle3003 Feb 23, 2026
1aad5aa
feat(search): improve startup and initialization of search index
marle3003 Feb 23, 2026
61a7c0b
feat(doc): add cta-links plugin
marle3003 Feb 23, 2026
939b6c2
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 23, 2026
084fec8
feat(doc): add cta-links plugin
marle3003 Feb 23, 2026
ae9c119
fix(documentation): correct linking
marle3003 Feb 24, 2026
c654405
test: improve test
marle3003 Feb 24, 2026
da3dc74
test: improve test
marle3003 Feb 24, 2026
a13c96d
test: improve test
marle3003 Feb 24, 2026
4fb616c
fix: adjust link URL
marle3003 Feb 24, 2026
90fd722
chore(webui): add redirects for old URLs
marle3003 Feb 24, 2026
b1fa88f
fix(javascript): allow using Object.assign in HTTP event handler
marle3003 Feb 24, 2026
1880fd5
doc: update documentations
marle3003 Feb 24, 2026
c4c95f9
chore: update redirect
marle3003 Feb 24, 2026
e51f82f
chore: fix redirect
marle3003 Feb 25, 2026
60df973
feat(search): improve startup and initialization of search index
marle3003 Feb 25, 2026
5744814
chore: add redirect URL
marle3003 Feb 25, 2026
06d8a78
chore: fix redirect
marle3003 Feb 25, 2026
e9f6da5
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 25, 2026
843ee3b
doc: update documentation
marle3003 Feb 25, 2026
f077b9b
Merge branch 'develop' into dependabot/go_modules/develop/github.com/…
marle3003 Feb 25, 2026
a34fb7e
Merge pull request #849 from marle3003/dependabot/go_modules/develop/…
github-actions[bot] Feb 25, 2026
1331781
Merge branch 'main' into develop
marle3003 Feb 25, 2026
1df4459
fix(search): disable search if error occurs during initialization
marle3003 Feb 25, 2026
67fb6e3
Merge remote-tracking branch 'origin/develop' into develop
marle3003 Feb 25, 2026
7e19bd9
Merge branch 'main' into develop
marle3003 Feb 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ jobs:
node-version: 23
registry-url: 'https://registry.npmjs.org'
- run: npm install
working-directory: ./webui
- name: Install taskfile
run: sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b ~/.local/bin
- name: Publish
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
data/*
dist/
bin/*
obj/
Debug/

node_modules

Expand Down
14 changes: 9 additions & 5 deletions acceptance/petstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,16 @@ func (suite *PetStoreSuite) TestEvents() {
try.AssertBody(func(t *testing.T, body string) {
var data map[string]any
err := json.Unmarshal([]byte(body), &data)
require.NoError(t, err)
assert.NoError(t, err)
results := data["results"].([]any)
evt := results[0].(map[string]any)
require.Equal(t, "Event", evt["type"])
require.Equal(t, "GET http://127.0.0.1:18080/user/bob", evt["title"])
require.Equal(t, "Swagger Petstore", evt["domain"])
assert.NotNil(t, results, "search result should contain results")
assert.Greater(t, len(results), 0)
evt, ok := results[0].(map[string]any)
assert.True(t, ok, "event should be a map[string]any")
assert.NotNil(t, evt)
assert.Equal(t, "Event", evt["type"])
assert.Equal(t, "GET http://127.0.0.1:18080/user/bob", evt["title"])
assert.Equal(t, "Swagger Petstore", evt["domain"])
}),
)
}
Expand Down
27 changes: 20 additions & 7 deletions api/handler_search_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package api

import (
"context"
"encoding/json"
"mokapi/config/dynamic"
"mokapi/config/dynamic/asyncApi/asyncapitest"
Expand All @@ -10,6 +11,7 @@ import (
"mokapi/providers/openapi/openapitest"
"mokapi/runtime"
"mokapi/runtime/search"
"mokapi/safe"
"mokapi/try"
"net/http"
"testing"
Expand Down Expand Up @@ -43,7 +45,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

cfg := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand All @@ -62,7 +65,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

cfg := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand All @@ -81,7 +85,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

cfg := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand All @@ -102,7 +107,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

cfg := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand Down Expand Up @@ -131,7 +137,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

h := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand Down Expand Up @@ -160,7 +167,8 @@ func TestHandler_SearchQuery(t *testing.T) {
},
app: func() *runtime.App {
app := runtime.New(&static.Config{Api: static.Api{Search: static.Search{
Enabled: true,
Enabled: true,
InMemory: true,
}}})

h := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "", ""))
Expand All @@ -180,7 +188,12 @@ func TestHandler_SearchQuery(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()

h := New(tc.app(), static.Api{})
app := tc.app()
pool := safe.NewPool(context.Background())
app.Start(pool)
defer pool.Stop()

h := New(app, static.Api{})

try.Handler(t,
http.MethodGet,
Expand Down
2 changes: 1 addition & 1 deletion api/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func TestHandler_NoDashboard(t *testing.T) {
}

func TestHandler_SearchEnabled(t *testing.T) {
h := api.New(runtime.New(&static.Config{}), static.Api{Dashboard: true, Search: static.Search{Enabled: true}})
h := api.New(runtime.New(&static.Config{}), static.Api{Dashboard: true, Search: static.Search{Enabled: true, InMemory: true}})
try.Handler(t,
http.MethodGet,
"http://foo.api/api/info",
Expand Down
2 changes: 2 additions & 0 deletions cmd/mokapi/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ api:
dashboard: true
search:
enabled: true
indexPath: ""
inMemory: false
rootCaCert: ""
rootCaKey: ""
configs: []
Expand Down
4 changes: 3 additions & 1 deletion config/static/static_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ type Api struct {
}

type Search struct {
Enabled bool
Enabled bool
IndexPath string `yaml:"indexPath" json:"indexPath" flag:"index-path"`
InMemory bool `yaml:"inMemory" json:"inMemory" flag:"in-memory"`
}

type FileProvider struct {
Expand Down
4 changes: 2 additions & 2 deletions docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -588,9 +588,9 @@
},
"items": [
{
"label": "Ensuring API Contract Compliance with Mokapi",
"label": "Guard Your API Contracts: Catch Breaking Changes Before Production",
"source": "resources/blogs/ensuring-api-contract-compliance-with-mokapi.md",
"path": "/resources/blogs/ensuring-api-contract-compliance-with-mokapi",
"path": "/resources/blogs/guard-your-api-contracts",
"hideNavigation": true
},
{
Expand Down
90 changes: 84 additions & 6 deletions docs/javascript-api/mokapi/eventhandler/eventargs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,34 @@ description: EventArgs is an object used to configure event handlers registered
[`on`](/docs/javascript-api/mokapi/on.md) function when registering an event handler.
It allows controlling how and when an event handler is executed.

| Name | Type | Description |
|----------|---------|--------------------------------------------------------------------------------------------------------|
| tags | object | Adds or overrides existing tags that are used in dashboard |
| priority | integer | Defines the execution priority of the event handler. Handlers with a higher value are executed first. |

If no priority is specified, the default priority is `0`.
<div class="table-responsive-sm">
<table>
<thead>
<tr>
<th scope="col" class="col-2">Name</th>
<th scope="col" class="col-2">Type</th>
<th scope="col" class="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>tags</td>
<td><code>object</code></td>
<td>Adds or overrides existing tags that are used in dashboard.</td>
</tr>
<tr>
<td>track</td>
<td><code>boolean | <br />(params) => boolean</code></td>
<td>Controls whether this event handler is tracked in the dashboard.</td>
</tr>
<tr>
<td>priority</td>
<td><code>integer</code></td>
<td>Defines the execution priority of the event handler. Handlers with a higher value are executed first. If no priority is specified, the default priority is <code>0</code>.</td>
</tr>
</tbody>
</table>
</div>

## Example: Adding custom tags

Expand All @@ -29,6 +51,62 @@ export default function() {
}
```

## Example: Controlling whether an event handler is tracked in the dashboard

The track field controls whether executions of an event handler appear in the dashboard.

It supports two modes:
- true / false — always track or never track
- a function — decide dynamically per request

### Static tracking

```javascript
on('http', handler, { track: true })
```

### Dynamic tracking (function)

```javascript
on('http', handler, {
track: (request, response) => request.key !== '/health'
})
```

### Full example: Delay simulation with tracking

```javascript
import { on, sleep } from 'mokapi'

export default () => {
let delay = undefined

on('http', (request, response) => {
if (request.key === '/simulations/delay') {
switch (request.method) {
case 'PUT':
delay = request.query.duration;
break;
case 'DELETE':
delay = undefined;
break;
}
}
}, { track: true })
on('http', (request, response) => {
if (!delay) {
sleep(delay);
}
}, { track: () => delay !== undefined } )
}
```

#### Explanation
- The first handler exposes a control endpoint to configure the delay.
- track: true ensures all configuration changes are visible in the dashboard.
- The second handler applies the delay to incoming requests.
- Tracking is enabled only while a delay is active, keeping the dashboard clean when no simulation is running.

## Example: Controlling execution order with priority

When multiple handlers are registered for the same event, the priority
Expand Down
Loading
Loading