Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

openapi-to-abap

БесплатноБез исполняемых скриптовНе проверен

Generate an ABAP REST client from an OpenAPI document using the v2 pipeline (3 interfaces + 1 class + bundled locals). USE WHEN the user wants to convert…

abapifyот abapify★ 20 звёзд на GitHub

Об этом скилле

OpenAPI → ABAP Client Codegen (v2)

This skill guides work on the abap-ast and openai-codegen packages: generating ABAP REST client classes from OpenAPI 3.0/3.1 documents, adding new target profiles, extending JSON-Schema → ABAP type mappings, and deploying the generated output to a live BTP Steampunk system.

When to use

Invoke this skill when the user asks to:

  • Convert an OpenAPI / Swagger document into an ABAP client.
  • Work inside packages/abap-ast/ or packages/openai-codegen/.
  • Add a new target profile (for example s4-onprem-modern, on-prem-classic).
  • Add or change a JSON-Schema → ABAP type mapping rule.
  • Deploy a generated client (e.g. Petstore3) to a BTP Steampunk tenant via adt-cli.
  • Debug parser errors reported by @abaplint/core against the generated source.

Do not use this skill for generic ADT endpoint work (use add-endpoint), object CRUD plumbing (use add-object-type), or format plugins (use adt-export).

Architecture summary (v2)

ZIF_<BASE>_TYPES   ── all schemas as ABAP TYPES (+ @openapi-schema markers)
        ▲
        │  zif_<base>_types=>…
        │
ZIF_<BASE>         ── all operations as typed METHODS (+ @openapi-operation markers)
        │                                                RAISING ZCX_<BASE>_ERROR
        │
ZCL_<BASE>         ── implements ZIF_<BASE>
                      one private attribute: client TYPE REF TO lcl_http
                      each method = fetch(...) + CASE response->status( )
                      ─────────────────────────────────────────────
                      local classes (in the same .clas, locals_def/imp):
                        lcl_http, lcl_response, json, lcl_json_parser

ZCX_<BASE>_ERROR   ── inherits cx_static_check
                      carries status / description / body / headers

Pipeline (one direction only):

loadSpec (oas/) ─► planTypes (types/) ─► resolveNames (emit/naming.ts)
         ─► emitTypesInterface / emitOperationsInterface / emitExceptionClass
         ─► emitImplementationClass / emitLocalClasses
         ─► print (abap-ast)  ─► writeClientBundle (format/)

Two packages:

  • abap-ast — zero-dependency typed AST + deterministic pretty-printer. Emit-only. Declaration nodes carry an optional abapDoc: readonly string[] field; the printer emits "! <line> above each declaration.
  • openai-codegen — pipeline + profile registry + CLI (packages/openai-codegen/src/cli.ts). Depends only on abap-ast.

Reference example: samples/petstore3-client/ — the generator output is the 11-file abapGit layout in samples/petstore3-client/generated/abapgit/.

Adding a new target profile

The locals bundle is shared in v2, so adding a profile is now mostly a registry + dispatcher change:

  1. Create packages/openai-codegen/src/profiles/<id>.ts exporting a TargetProfile (id, ABAP language version, allowed kernel classes). Mirror cloud.ts.
  2. Register it in packages/openai-codegen/src/profiles/registry.ts (PROFILES, ALL_PROFILES) and add the id to TargetProfileId in profiles/types.ts.
  3. Remove the short-circuit in packages/openai-codegen/src/generate.ts (assertSupportedTarget) or extend it to accept the new id.
  4. If the new profile needs a different kernel class (e.g. cl_http_client for classic on-prem), branch inside packages/openai-codegen/src/emit/templates/locals-*.abap.ts. Avoid forking the whole bundle — prefer a small conditional.
  5. Update the CLI whitelist in packages/openai-codegen/src/cli.ts (parseTarget) if needed.
  6. Add a Vitest suite under packages/openai-codegen/tests/ that runs the pipeline with --target <id> and parse-checks the output via @abaplint/core.

Adding a new JSON-Schema → ABAP mapping rule

Type mapping lives in packages/openai-codegen/src/types/map.ts. To add a rule (e.g. format: "uuid" → sysuuid_x16):

  1. Extend the mapping in src/types/map.ts. Keep it pure: JsonSchema → AbapTypeRef | AbapTypeDef, no side effects.
  2. If the new shape introduces a named TypeDef, allocate via the planner's NameAllocator in src/types/plan.ts.
  3. If cycles are possible, confirm the back-edge handling: the planner breaks cycles with REF TO data and attaches a `"! @openapi-ref

:marker. Add a fixture. 4. Add a test inpackages/openai-codegen/tests/types-emit.test.ts asserting both the AST shape and the printed ABAP. 5. Update the mapping table inpackages/openai-codegen/README.md`.

Adding a new CLI flag

  1. Extend RawCliOptions + buildCliRunOptions in packages/openai-codegen/src/cli.ts.
  2. Thread through GenerateOptions in packages/openai-codegen/src/generate.ts if it affects emission.
  3. Add help text and a unit test in the CLI test suite.

Deploying to BTP Steampunk

Short recipe:

bunx adt auth login
bunx @abapify/openai-codegen \
  --input ./spec/openapi.json \
  --out ./generated/abapgit \
  --f
Полный SKILL.md на GitHub

Установить openapi-to-abap в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл openapi-to-abap?

Generate an ABAP REST client from an OpenAPI document using the v2 pipeline (3 interfaces + 1 class + bundled locals). USE WHEN the user wants to convert OpenAPI / Swagger into ABAP, work on the abap-ast or openai-codegen packages, add a new target profile, add a JSON-Schema to ABAP type mapping, or deploy a generated client to BTP Steampunk. Trigger phrases - openapi to abap, generate abap client from openapi, openai-codegen, abap rest client, swagger abap client, petstore abap, abap-ast, typed ABAP AST, ABAP pretty printer, add target profile, add schema mapping, ZIF_types, ZIF_ops, ZCX_error.

Как установить скилл openapi-to-abap?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл openapi-to-abap запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить openapi-to-abap с