Skip to content

Variable: commentSchema ​

ts
const commentSchema: ZodObject<{
  content_type: ZodOptional<ZodString>;
  created_at: ZodOptional<ZodNumber>;
  pk: ZodOptional<ZodCoercedString<unknown>>;
  status: ZodOptional<ZodString>;
  text: ZodOptional<ZodString>;
  user: ZodOptional<ZodObject<{
     biography: ZodOptional<ZodString>;
     external_url: ZodOptional<ZodNullable<ZodString>>;
     follower_count: ZodOptional<ZodNullable<ZodNumber>>;
     following_count: ZodOptional<ZodNullable<ZodNumber>>;
     full_name: ZodOptional<ZodString>;
     is_private: ZodOptional<ZodBoolean>;
     is_verified: ZodOptional<ZodBoolean>;
     media_count: ZodOptional<ZodNullable<ZodNumber>>;
     pk: ZodOptional<ZodCoercedString<unknown>>;
     profile_pic_url: ZodOptional<ZodNullable<ZodString>>;
     username: ZodOptional<ZodString>;
  }, $loose>>;
}, $loose>;

A comment as the create endpoint returns it. Lean and lenient: only the exposed fields are typed, the rest pass through, and each is optional because the API's shape varies by context. The author is the shared User model.

MIT License. Not affiliated with, endorsed or sponsored by Meta or Instagram.