rip-lang 3.13.136 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/RIP-TYPES.md CHANGED
@@ -721,26 +721,33 @@ export function getUser(id: number): User | undefined;
721
721
  ## Boundary Validation
722
722
 
723
723
  Types are compile-time contracts. For data entering your system, validate
724
- at boundaries:
724
+ at boundaries — and in Rip, the `schema` keyword is the native way to do
725
+ it. Schemas are runtime validators AND a source of TypeScript types (via
726
+ shadow `.d.ts` emission), so one declaration gives you both the check
727
+ and the type.
725
728
 
726
729
  ```coffee
727
- import { z } from "zod"
730
+ # Declare the wire shape — runtime validator + type source of truth
731
+ User = schema :input
732
+ id! integer
733
+ name! 1..50
734
+ email! email
728
735
 
729
- # Define schema (runtime validation + type source of truth)
730
- UserSchema = z.object
731
- id: z.number()
732
- name: z.string()
733
- email: z.string().email()
734
-
735
- # Derive type from schema
736
- type User = z.infer<typeof UserSchema>
737
-
738
- # Validate at API boundary
736
+ # Validate at an API boundary
739
737
  def createUser(req:: Request):: User
740
- data = req.json!
741
- UserSchema.parse(data)
738
+ User.parse req.json! # throws SchemaError on invalid
739
+
740
+ # Or non-throwing for structured error responses
741
+ result = User.safe req.json!
742
+ # result: {ok: true, value: User} | {ok: false, errors: [...]}
742
743
  ```
743
744
 
745
+ The compiler emits the TypeScript `User` type from the schema definition
746
+ automatically. No `z.infer<>` step. See [RIP-SCHEMA.md](./RIP-SCHEMA.md)
747
+ for the full schema reference — field grammar, modifiers, constraints,
748
+ cross-field `@ensure` refinements, `:model` ORM surface, algebra
749
+ (`.pick/.omit/.partial/.extend`), and shadow TypeScript emission.
750
+
744
751
  Once data passes boundary validation, trust the types internally — no need
745
752
  to re-validate.
746
753