一键导入
openapi-sync
Fetch Django OpenAPI schema and regenerate TypeScript types and Zod schemas
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Fetch Django OpenAPI schema and regenerate TypeScript types and Zod schemas
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Best practice AI & LLM discoverability for Nuxt sites. ALWAYS use when writing code importing "nuxt-ai-ready". Consult for debugging, best practices, or modifying nuxt-ai-ready, nuxt ai ready.
Scaffold a new Nitro server API route under server/api/ following the project's strict 4-step pattern (Zod input → $fetch to Django → parseDataAs response → handleError catch). Use when adding a new endpoint that proxies the Django backend. Pick the right variant — cached GET, mutating POST/PUT/PATCH, cart-aware, allauth-protected, or dynamic-param.
Find hardcoded user-facing strings (Greek or English) in Vue components and pages, propose i18n keys, and add translations to either component-scoped <i18n lang="yaml"> blocks or shared locale files under i18n/locales/. Use after adding/editing UI to enforce the project's "no hardcoded strings" rule. Locale el is the only active locale — do not generate en/de translations.
| name | openapi-sync |
| description | Fetch Django OpenAPI schema and regenerate TypeScript types and Zod schemas |
| disable-model-invocation | true |
Synchronize the OpenAPI schema from the Django backend and regenerate TypeScript types and Zod validation schemas.
NUXT_API_BASE_URL (default: http://localhost:8000/api/v1)DJANGO_API_TOKEN env var or .auth-token file must exist for authenticationExecute these steps in order:
pnpm generate:schema
This runs scripts/fetch-schema.mjs which downloads:
openapi/schema.jsonopenapi/schema.ymlIf this fails, check:
DJANGO_API_TOKEN set or .auth-token file present?NUXT_API_BASE_URL configured in .env?pnpm openapi-ts
This uses @hey-api/openapi-ts (configured in openapi-ts.config.ts) to generate:
shared/openapi/types.gen.ts — TypeScript type definitionsshared/openapi/zod.gen.ts — Zod validation schemasOutput is post-processed with ESLint for consistent formatting.
npx vue-tsc --noEmit
Check for any type errors introduced by the schema changes.
Run git diff --stat shared/openapi/ to show what changed in the generated files.
If there are breaking changes (removed types, renamed fields), flag them — they may require updates to:
shared/schemas/ (hand-written Zod schemas that reference generated types)server/api/ routes (that use parseDataAs with generated schemas)app/ components and composables (that use generated types)types.gen.ts, zod.gen.ts) should NEVER be edited manuallyopenapi-ts.config.ts configures: input from schema.json, output to shared/openapi/, plugins for TypeScript and Zod with date offset handlingshared/openapi/zod.gen.ts are prefixed with z (e.g., zGetLoyaltySummaryResponse)shared/schemas/ may wrap or extend generated schemas