feat(schema): add schema package with type-safe helpers#480
Draft
maoberlehner wants to merge 22 commits intomainfrom
Draft
feat(schema): add schema package with type-safe helpers#480maoberlehner wants to merge 22 commits intomainfrom
maoberlehner wants to merge 22 commits intomainfrom
Conversation
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.
95d081c to
a786686
Compare
@storyblok/angular
@storyblok/astro
@storyblok/api-client
storyblok
@storyblok/eslint-config
@storyblok/js
storyblok-js-client
@storyblok/live-preview
@storyblok/management-api-client
@storyblok/migrations
@storyblok/nuxt
@storyblok/react
@storyblok/region-helper
@storyblok/richtext
@storyblok/schema
@storyblok/svelte
@storyblok/vue
commit: |
1f5f821 to
9ed0471
Compare
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
9ed0471 to
17c377e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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