MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / buildBatchSchemaHint

Function buildBatchSchemaHint

app/src/API/Handlers/ProjectHandler.cpp:5210–5236  ·  view source on GitHub ↗

* @brief Runs an array of project mutations sequentially under a suspended autosave. */ * @brief Returns the schema-hint object attached to every project.batch validation error. */

Source from the content-addressed store, hash-verified

5208 * @brief Returns the schema-hint object attached to every project.batch validation error.
5209 */
5210static QJsonObject buildBatchSchemaHint()
5211{
5212 QJsonObject example;
5213 QJsonArray exampleOps;
5214 QJsonObject op0;
5215 op0[QStringLiteral("command")] = QStringLiteral("project.dataset.update");
5216 QJsonObject p0;
5217 p0[QStringLiteral("groupId")] = 0;
5218 p0[Keys::DatasetId] = 0;
5219 p0[QStringLiteral("title")] = QStringLiteral("LED 1");
5220 p0[QStringLiteral("index")] = 1;
5221 op0[QStringLiteral("params")] = p0;
5222 exampleOps.append(op0);
5223 example[QStringLiteral("ops")] = exampleOps;
5224 example[QStringLiteral("stopOnError")] = false;
5225
5226 QJsonObject hint;
5227 hint[QStringLiteral("expected")] =
5228 QStringLiteral("{ ops: Array<{command: string, params: object}>, stopOnError?: boolean }");
5229 hint[QStringLiteral("opShape")] =
5230 QStringLiteral("Each op MUST be {command: '<registered name>', params: {...}}. Per-call "
5231 "args go INSIDE params, not at the top of the op object.");
5232 hint[QStringLiteral("limits")] =
5233 QStringLiteral("1 <= ops.length <= 1024. Nested project.batch is rejected.");
5234 hint[QStringLiteral("example")] = example;
5235 return hint;
5236}
5237
5238/**
5239 * @brief Builds a per-op result entry for a validation failure inside project.batch.

Callers 2

executeBatchOpFunction · 0.85
validateBatchOpsFunction · 0.85

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected