Skip to content

feat(schema): add schema package with type-safe helpers#480

Draft
maoberlehner wants to merge 22 commits intomainfrom
feature/WDX-264-schemas
Draft

feat(schema): add schema package with type-safe helpers#480
maoberlehner wants to merge 22 commits intomainfrom
feature/WDX-264-schemas

Conversation

@maoberlehner
Copy link
Copy Markdown
Contributor

@maoberlehner maoberlehner commented Mar 6, 2026

Introduce @storyblok/schema, a new package providing typed helper functions (defineComponent, defineStory, defineField, defineProp, etc.) for building Storyblok content schemas. Includes MAPI-specific helpers and Zod schema generation from OpenAPI specs.

Fixes WDX-264

Rewrite management API OpenAPI specifications to use proper request/response
schemas for create and update operations. Extract shared story schemas and
align CAPI operation IDs with list naming convention.

BREAKING CHANGE: MAPI OpenAPI operation IDs and schema names have changed.
… architecture

Replace the old class-based client with a functional, resource-oriented API.
Each resource (stories, components, assets, etc.) is now a separate module
with typed CRUD operations generated from the shared OpenAPI specs.
Add built-in rate limiting, fetchOptions passthrough, and generic PATCH helper.

BREAKING CHANGE: The client API has been completely rewritten. Use
createManagementApiClient() instead of new ManagementApiClient(), and
access resources via client.stories.list() instead of client.getAll().
…PI specs

Rename getAll methods to list across all CAPI resources for consistency
with the management API client naming convention.

BREAKING CHANGE: All getAll() methods have been renamed to list().
…e-exports

Replace direct imports from @storyblok/management-api-client resource
modules with imports from a local types module that re-exports from the
new client. Fix parent_id fallback in mapRefs to preserve original value
when no mapping exists.
… Asset type

Add new urlToAssetField() utility that creates Storyblok asset field objects
from URLs. Refactor urlToAsset() to return the MAPI Asset type instead of the
old StoryblokAsset shape, and simplify urlToLink() return type.

BREAKING CHANGE: urlToAsset() now returns an Asset (MAPI) object instead of
StoryblokAsset. Use the new urlToAssetField() for the old asset field shape.
Update all CLI commands to use the new resource-based management API client
and the renamed list() methods from the content API client. Refactor asset
upload flow to use mapi-client directly, centralize management types in
cli/types, and simplify rate limiting (now handled by mapi-client).
Clarify that the cdn/links endpoint never returns story content to
prevent confusion with list responses and guide QA to fetch individual
stories for full data
Align test datasource JSON fixtures with the updated datasource schema
that uses `entries` instead of `datasource_entries` to keep tests
accurate and maintainable.
Update CLI component push to wrap internal_tag in request body object.
Add FieldSchema type to handle discriminated union from refactored
ComponentPropertySchema. Fix MAPI tests for matching request shapes.
…ipts

Prefix test descriptions with 'should' across capi-client and
mapi-client. Unify script naming: add test:types, test:e2e, coverage;
remove legacy typecheck script. Update CLI test guide and agent docs.
@maoberlehner maoberlehner force-pushed the feature/WDX-264-schemas branch from 95d081c to a786686 Compare March 27, 2026 14:45
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 27, 2026

Open in StackBlitz

@storyblok/angular

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/angular@480

@storyblok/astro

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/astro@480

@storyblok/api-client

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/api-client@480

storyblok

npm i https://pkg.pr.new/storyblok/monoblok/storyblok@480

@storyblok/eslint-config

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/eslint-config@480

@storyblok/js

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/js@480

storyblok-js-client

npm i https://pkg.pr.new/storyblok/monoblok/storyblok-js-client@480

@storyblok/live-preview

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/live-preview@480

@storyblok/management-api-client

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/management-api-client@480

@storyblok/migrations

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/migrations@480

@storyblok/nuxt

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/nuxt@480

@storyblok/react

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/react@480

@storyblok/region-helper

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/region-helper@480

@storyblok/richtext

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/richtext@480

@storyblok/schema

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/schema@480

@storyblok/svelte

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/svelte@480

@storyblok/vue

npm i https://pkg.pr.new/storyblok/monoblok/@storyblok/vue@480

commit: 17c377e

@maoberlehner maoberlehner force-pushed the feature/WDX-264-schemas branch 2 times, most recently from 1f5f821 to 9ed0471 Compare March 31, 2026 07:12
@maoberlehner maoberlehner changed the title Schemas feat(schema): add schema package with type-safe helpers Mar 31, 2026
Introduce @storyblok/schema, a new package providing typed helper
functions (defineComponent, defineStory, defineField, defineProp, etc.)
for building Storyblok content schemas. Includes MAPI-specific helpers
and Zod schema generation from OpenAPI specs.

Fixes WDX-264
…tion

- Expose curated Zod schemas for CAPI and MAPI via
  `@storyblok/schema/zod` and `@storyblok/schema/zod/mapi` to support
  robust runtime validation
- Introduce component and field-level MAPI Zod wrappers so component
  schema fields are validated against the full field union instead of
  untyped records

Fixes WDX-264
@maoberlehner maoberlehner force-pushed the feature/WDX-264-schemas branch from 9ed0471 to 17c377e Compare March 31, 2026 07:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant