-
Notifications
You must be signed in to change notification settings - Fork 86
update the action schemas #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
@eucyt Hello. Euchi-san. I created the PR. I'm going to review by my self. |
dff40b2 to
7a189bb
Compare
eucyt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
We’re planning to automatically generate the schema from the OpenAPI definition.
#304
By doing so, we can eliminate the need for manual additions and reviews like this time.
It will also make it easier to keep up with updates to the Messaging API.
(We’re open to any good ideas if you have them! 😄 )
| z.object({ | ||
| type: z.literal("filler"), | ||
| flex: flexWeightSchema.optional(), | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| z.object({ | |
| type: z.literal("filler"), | |
| flex: flexWeightSchema.optional(), | |
| }), |
Filler is deprecated.
https://developers.line.biz/en/reference/messaging-api/#flex-message
| z.object({ | ||
| type: z.literal("spacer"), | ||
| size: spacerSizeSchema.optional(), | ||
| }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| z.object({ | |
| type: z.literal("spacer"), | |
| size: spacerSizeSchema.optional(), | |
| }), |
spacer is also deprecated.
line/line-openapi#17
| initial: z.string().datetime().optional(), | ||
| max: z.string().datetime().optional(), | ||
| min: z.string().datetime().optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the format changes depending on the mode, you should use something like string() instead of datetime().
https://developers.line.biz/en/reference/messaging-api/#date-and-time-format
| z.object({ | ||
| type: z.literal("richmenuswitch"), | ||
| label: z.string().min(1).max(20), | ||
| richMenuAliasId: z.string().min(1).max(300), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| richMenuAliasId: z.string().min(1).max(300), | |
| richMenuAliasId: z.string().min(1).max(32), |
| header: flexComponentSchema.optional(), | ||
| hero: flexComponentSchema.optional(), | ||
| body: flexComponentSchema.optional(), | ||
| footer: flexComponentSchema.optional(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
header / body / footer accept Box only and hero accepts Box, Video and Image.
https://developers.line.biz/ja/reference/messaging-api/#container





Background
The existing Flex Message schema was broken when attempting to create complex flex messages.
The previous implementation used a simple passthrough validation approach that couldn't handle the intricate structure and validation requirements of LINE's Flex Message format.
This resulted in:
To address these issues, this PR implements a comprehensive schema based on the official LINE OpenAPI specification: https://github.com/line/line-openapi/blob/main/messaging-api.yml
Summary
This PR completely refactors the Flex Message schema to provide comprehensive validation that aligns with the official LINE Messaging API specification, fixing the broken complex flex message creation and ensuring type safety for all flex message components.
Changes
Schema Architecture Fixes
Component Support (Based on OpenAPI spec)
Validation Enhancements
mdfor sizes) matching LINE's specificationAction Types (Complete OpenAPI coverage)
Technical Improvements
References
Todo