openlark-validation-style_skill

This skill standardizes how to implement and review required-field validation in OpenLark feature crates using macros and functions.
  • Rust

48

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill foxzool/open-lark --skill openlark-validation-style

  • SKILL.md3.0 KB

Overview

This skill documents the OpenLark Rust SDK convention for required-field validation in feature crates. It explains when to use the provided macro vs the function, how to treat blank strings, and how to aggregate validation errors consistently. The goal is to standardize validate() implementations and avoid duplicated or drifting rules across crates.

How this skill works

It recommends using openlark_core::validate_required! (macro) for fast-fail required checks inside validate() and passing string fields as .trim() to treat blank strings as missing. For cases that need to collect multiple errors or control flow, it recommends openlark_core::validation::validate_required (function), which returns a bool after trimming. It also forbids redefining the same macro in feature crates to keep behavior and error types uniform.

When to use it

  • Use the macro openlark_core::validate_required! inside validate() when a missing required field should immediately return Err.
  • Use the validation::validate_required function when you need to aggregate multiple validation errors or avoid immediate return.
  • Always trim string inputs when you want blank-only strings to be treated as missing.
  • Pass non-string containers (e.g., Vec<T>) directly to the macro; the macro checks is_empty().
  • Do not duplicate a validate_required macro in feature crates; reuse openlark_core to keep behavior consistent.

Best practices

  • Prefer the macro for concise, fast-fail required-field checks inside validate().
  • Call .trim() on string fields before passing to the macro so whitespace-only values count as missing.
  • Use the function variant when you need to collect errors and build a combined error response.
  • Keep validation error messages consistent and use openlark_core error helpers when constructing Err values.
  • Avoid reimplementing validate_required semantics in each crate—reference openlark_core to prevent divergences.

Example use cases

  • A request Builder.validate() that should return immediately if app_token or table_id are absent: use validate_required! with .trim().
  • Validating a Vec<T> items field: pass the Vec directly to the macro, which checks is_empty().
  • Code review or design audits where you standardize validate() implementations across feature crates.

FAQ

Use the macro for simple, immediate-fail required checks inside validate(). Use the function when you need to aggregate multiple errors or manage return timing yourself.

Do I need to .trim() before validation?

Yes for the macro: trim strings before passing them because the macro uses .is_empty(). The function already trims before checking, so explicit trim is optional when using the function.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
openlark-validation-style skill by foxzool/open-lark | VeilStrat