Skip to content

docs: fix mocking config note and invalid JSON in elasticsearch-logger examples#13543

Open
AlinsRan wants to merge 1 commit into
apache:masterfrom
AlinsRan:docs/fix-mocking-and-es-logger-examples
Open

docs: fix mocking config note and invalid JSON in elasticsearch-logger examples#13543
AlinsRan wants to merge 1 commit into
apache:masterfrom
AlinsRan:docs/fix-mocking-and-es-logger-examples

Conversation

@AlinsRan

Copy link
Copy Markdown
Contributor

What this fixes

Two documentation issues found during a docs audit:

1. mocking — inaccurate constraint description

docs/{en,zh}/latest/plugins/mocking.md state that response_example and response_schema "must not be configured together". That is wrong: the schema uses anyOf (at least one required), so configuring both is valid, and the plugin prefers response_example when both are set:

-- apisix/plugins/mocking.lua
anyOf = {
    { required = { "response_example" } },
    { required = { "response_schema" } },
}
...
if conf.response_example then          -- response_example wins when both set
    response_content = conf.response_example
else
    local output = gen_object(conf.response_schema)

Corrected to: at least one must be configured; if both are configured, response_example takes precedence and response_schema is ignored.

2. elasticsearch-logger — invalid JSON in examples

The Admin API examples had a trailing comma after the only key ("index": "gateway",), which makes the JSON invalid on copy-paste. Removed it (en + zh, two places each).

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change (N/A, docs only)
  • I have updated the documentation to reflect this change
  • I have verified that the changes pass the existing tests

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. doc Documentation things labels Jun 12, 2026
…r examples

- mocking: the docs say response_example and response_schema must not be
  configured together, but the schema uses anyOf (at least one) and the
  plugin prefers response_example when both are set. Correct the en/zh
  description accordingly.
- elasticsearch-logger: the Admin API examples had a trailing comma after
  the only field ("index": "gateway",), making the JSON invalid for
  copy-paste. Remove it (en + zh, two places each).

Signed-off-by: AlinsRan <alinsran@apache.org>
@AlinsRan AlinsRan force-pushed the docs/fix-mocking-and-es-logger-examples branch from 5457d34 to 7a5b4e1 Compare June 12, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Documentation things size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant