API Design
Основано на статье Infostart "База по API": https://infostart.ru/1c/articles/2683808/.
MCP routing
- Preferred path: use MCP
unica tools unica.search, unica.check, unica.view {}, unica.view on the subsystem node, unica.view on the object node, unica.docs, and unica.run.
- Runtime идёт через
unica.run: вызов без op отдаёт словарь операций и
контракт каждой — argsSchema, execution, previewRequired,
ifRevRequiredOnApply. Контракт вызова бери оттуда, а не из этого текста;
выбирай только операцию с implemented: true и не выдумывай аргументов
записи с argsSchema: null; превью исполнением не является. Не обходи
контракт прямым runner-ом.
- Use v8std through
unica.docs with source: "development-standard" for standards 483, 543, 551, 553, and 644 before making compatibility claims.
- Use
test-authoring for unit tests that model API consumer scenarios; use integration-implement only when the task is about HTTP/REST/SOAP/gRPC transport implementation.
- Do not call internal analyzer, standards, runtime, or package adapters directly. They are hidden behind MCP
unica.
Core model
Treat 1C as a modular monolith: libraries contain functional subsystems, and subsystems communicate through declared interfaces. Direct access across subsystem/library boundaries is a design decision, not a convenience.
Classify every exported method before changing or calling it:
Программный интерфейс: public contract for external consumers; backward compatibility is required.
Для вызова из других подсистем: stable integration-facing area; do not treat it as arbitrary internal code.
Переопределяемый интерфейс: extension point called by the library; compatibility is required for consumers that implement it.
Служебный программный интерфейс: internal contract inside one library; forward compatibility is expected, backward compatibility is not guaranteed.
Служебные процедуры и функции: private implementation inside one functional subsystem; external calls are a defect unless the project explicitly documents otherwise.
Workflow
- Map source-sets with
unica.view {} and inspect subsystem/object boundaries with unica.view on the subsystem node or unica.view on the object node.
- When the API belongs to a concrete metadata object, inspect
unica.view on the object node for related modules, roles, subscriptions, and functional options before classifying the boundary.
- Find the candidate API with
unica.search; inspect the module with unica.view on the module node (its Method branch lists the methods) before reading broad code.
- Find callers and impact of exported methods with
unica.search by the method name (a call graph is not on the v0.13 surface); the same search covers export area comments, module suffixes, deprecated sections, and literal contract mentions.
- Check standards through
unica.docs with source: "development-standard": functional subsystems, libraries, overridable modules, version numbering, and backward compatibility.
- Classify the change: new method, optional parameter, mandatory parameter, removed/renamed method, changed parameter type, behavior change, deprecated method, or direct data access across a boundary.
- Decide the required version impact and migration path.
- Verify statically with
unica.check on the module node (test runs are outside the v0.13 surface), then report runtime behavior as unverified unless separate evidence is supplied. Keep consumer-style tests for APIs with real callers.
Compatibility rules
- Adding a public method or optional public parameter is new functionality: raise the version number, not only the build number.
- Adding a mandatory parameter, removing a mandatory parameter, deleting a public method, or changing a parameter type is breaking unless old callers still work through an adapter.
- Renaming a parameter usually does not break BSL callers because calls are positional, but changing the meaning of the parameter can still break behavior.
- Renaming or deleting a public method requires keeping the old signature in an
Устаревшие процедуры и функции area and adding a migration path.
- Compatibility requirements override cosmetic standards such as renaming for style.
- Build number changes are for bug fixes; do not smuggle public API expansion into a build-only release.
Overridable modules
For переопределяемые modules:
- Do not add new mandatory procedures or mandatory parameters.
- Do not change parameter types.
- Do not delete parameters that existing implementations may still receive.
- New optional procedures and optional parameters are acceptable when old implementations keep working.
- A removed parameter should be retained as unused/deprecated until consumers can migrate.
API-first checklist
- Confirm an API is really needed; prefer simpler manual or existing mechanisms when the task does not require system-to-system integration.
- Describe use cases, data flow, state model, auth, errors, idempotency, and consumer migration before implementation.
- Choose transport separately from contract: HTTPS/REST, SOAP, gRPC, file exchange, CLI, WebSocket, or in-process module API.
- Treat API release as product release: documentation, version impact, changelog, consumer notification, and tests.
- Write unit or integration tests that model consumer calls; they become upgrade checks for the contract.
Review red flags
- Calls to service procedures from another functional subsystem.
- Calls to service program interface from another library without an explicit contract.
- Query joins or selects across subsystem data when tables/fields are not documented as part of the API.
- Public API behavior changes hidden under bug-fix version increments.
- Removed or renamed public methods without deprecated wrappers.
- Suppressed AПК or BSL LS warnings around deprecated/interface-boundary diagnostics without a documented reason.
MCP examples
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "unica.docs",
"arguments": {
"query": "стандарт 644",
"source": "development-standard"
}
}
}
{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"name": "unica.search",
"arguments": {
"query": "Устаревшие процедуры и функции",
"scope": "<source-set-from-unica-view>:Configuration",
"limit": 20
}
}
}
1---2name: api-design3description: Проектирование и ревью API 1С: публичный программный интерфейс, служебный интерфейс, переопределяемые модули, совместимость, версионирование и миграция потребителей. Используй когда нужно спроектировать API, оценить изменение экспортных методов или проверить, можно ли вызывать метод/запрос из другой подсистемы.4---56# API Design78Основано на статье Infostart "База по API": `https://infostart.ru/1c/articles/2683808/`.910## MCP routing1112- Preferred path: use MCP `unica` tools `unica.search`, `unica.check`, `unica.view {}`, `unica.view` on the subsystem node, `unica.view` on the object node, `unica.docs`, and `unica.run`.13- Runtime идёт через `unica.run`: вызов без `op` отдаёт словарь операций и14контракт каждой — `argsSchema`, `execution`, `previewRequired`,15`ifRevRequiredOnApply`. Контракт вызова бери оттуда, а не из этого текста;16выбирай только операцию с `implemented: true` и не выдумывай аргументов17записи с `argsSchema: null`; превью исполнением не является. Не обходи18контракт прямым runner-ом.19- Use v8std through `unica.docs` with `source: "development-standard"` for standards 483, 543, 551, 553, and 644 before making compatibility claims.20- Use `test-authoring` for unit tests that model API consumer scenarios; use `integration-implement` only when the task is about HTTP/REST/SOAP/gRPC transport implementation.21- Do not call internal analyzer, standards, runtime, or package adapters directly. They are hidden behind MCP `unica`.2223## Core model2425Treat 1C as a modular monolith: libraries contain functional subsystems, and subsystems communicate through declared interfaces. Direct access across subsystem/library boundaries is a design decision, not a convenience.2627Classify every exported method before changing or calling it:2829- `Программный интерфейс`: public contract for external consumers; backward compatibility is required.30- `Для вызова из других подсистем`: stable integration-facing area; do not treat it as arbitrary internal code.31- `Переопределяемый интерфейс`: extension point called by the library; compatibility is required for consumers that implement it.32- `Служебный программный интерфейс`: internal contract inside one library; forward compatibility is expected, backward compatibility is not guaranteed.33- `Служебные процедуры и функции`: private implementation inside one functional subsystem; external calls are a defect unless the project explicitly documents otherwise.3435## Workflow36371. Map source-sets with `unica.view {}` and inspect subsystem/object boundaries with `unica.view` on the subsystem node or `unica.view` on the object node.382. When the API belongs to a concrete metadata object, inspect `unica.view` on the object node for related modules, roles, subscriptions, and functional options before classifying the boundary.393. Find the candidate API with `unica.search`; inspect the module with `unica.view` on the module node (its `Method` branch lists the methods) before reading broad code.404. Find callers and impact of exported methods with `unica.search` by the method name (a call graph is not on the v0.13 surface); the same search covers export area comments, module suffixes, deprecated sections, and literal contract mentions.415. Check standards through `unica.docs` with `source: "development-standard"`: functional subsystems, libraries, overridable modules, version numbering, and backward compatibility.426. Classify the change: new method, optional parameter, mandatory parameter, removed/renamed method, changed parameter type, behavior change, deprecated method, or direct data access across a boundary.437. Decide the required version impact and migration path.448. Verify statically with `unica.check` on the module node (test runs are outside the v0.13 surface), then report runtime behavior as unverified unless separate evidence is supplied. Keep consumer-style tests for APIs with real callers.4546## Compatibility rules4748- Adding a public method or optional public parameter is new functionality: raise the version number, not only the build number.49- Adding a mandatory parameter, removing a mandatory parameter, deleting a public method, or changing a parameter type is breaking unless old callers still work through an adapter.50- Renaming a parameter usually does not break BSL callers because calls are positional, but changing the meaning of the parameter can still break behavior.51- Renaming or deleting a public method requires keeping the old signature in an `Устаревшие процедуры и функции` area and adding a migration path.52- Compatibility requirements override cosmetic standards such as renaming for style.53- Build number changes are for bug fixes; do not smuggle public API expansion into a build-only release.5455## Overridable modules5657For переопределяемые modules:5859- Do not add new mandatory procedures or mandatory parameters.60- Do not change parameter types.61- Do not delete parameters that existing implementations may still receive.62- New optional procedures and optional parameters are acceptable when old implementations keep working.63- A removed parameter should be retained as unused/deprecated until consumers can migrate.6465## API-first checklist6667- Confirm an API is really needed; prefer simpler manual or existing mechanisms when the task does not require system-to-system integration.68- Describe use cases, data flow, state model, auth, errors, idempotency, and consumer migration before implementation.69- Choose transport separately from contract: HTTPS/REST, SOAP, gRPC, file exchange, CLI, WebSocket, or in-process module API.70- Treat API release as product release: documentation, version impact, changelog, consumer notification, and tests.71- Write unit or integration tests that model consumer calls; they become upgrade checks for the contract.7273## Review red flags7475- Calls to service procedures from another functional subsystem.76- Calls to service program interface from another library without an explicit contract.77- Query joins or selects across subsystem data when tables/fields are not documented as part of the API.78- Public API behavior changes hidden under bug-fix version increments.79- Removed or renamed public methods without deprecated wrappers.80- Suppressed AПК or BSL LS warnings around deprecated/interface-boundary diagnostics without a documented reason.8182## MCP examples8384```jsonc85{86 "jsonrpc": "2.0",87 "method": "tools/call",88 "params": {89 "name": "unica.docs",90 "arguments": {91 "query": "стандарт 644",92 "source": "development-standard"93 }94 }95}96```9798```jsonc99{100 "jsonrpc": "2.0",101 "method": "tools/call",102 "params": {103 "name": "unica.search",104 "arguments": {105 "query": "Устаревшие процедуры и функции",106 "scope": "<source-set-from-unica-view>:Configuration",107 "limit": 20108 }109 }110}111```