Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ Typed arrays: `let nums: array<i32> = [1, 2, 3];`

---

## Standard Library (42 modules)
## Standard Library (43 modules)

Import with `@stdlib/` prefix:
```hemlock
Expand Down Expand Up @@ -586,6 +586,7 @@ import { TcpStream, UdpSocket } from "@stdlib/net";
| `ipc` | Inter-process communication |
| `iter` | Iterator utilities |
| `json` | parse, stringify, pretty, get, set |
| `json_schema` | validate, is_valid, schema builders |
| `logging` | Logger with levels |
| `math` | sin, cos, sqrt, pow, rand, PI, E |
| `net` | TcpListener, TcpStream, UdpSocket |
Expand Down Expand Up @@ -979,7 +980,7 @@ make parity
- Manual memory management with `talloc()` and `sizeof()`
- Async/await with true pthread parallelism
- Atomic operations for lock-free concurrent programming
- 42 stdlib modules (+ arena, assert, semver, toml, retry, iter, random, shell, termios, vector)
- 43 stdlib modules (+ arena, assert, semver, toml, retry, iter, random, shell, termios, vector, json_schema)
- FFI for C interop with `export extern fn` for reusable library wrappers
- FFI struct support in compiler (pass C structs by value)
- FFI pointer helpers (`ptr_null`, `ptr_read_*`, `ptr_write_*`)
Expand Down
18 changes: 18 additions & 0 deletions stdlib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,21 @@ Full-featured JSON manipulation library:

See [docs/json.md](docs/json.md) for detailed documentation.

### JSON Schema (`@stdlib/json_schema`)
**Status:** Complete

JSON Schema validation for structured output (pure Hemlock, built on `@stdlib/json`):
- **Core:** validate, is_valid, validate_json
- **Schema keywords:** type, enum, const, required, properties, items, additionalProperties
- **Number constraints:** minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf
- **String constraints:** minLength, maxLength
- **Array constraints:** minItems, maxItems, uniqueItems
- **Composition:** allOf, anyOf, oneOf, not, if/then/else
- **Builders:** string_type, number_type, integer_type, boolean_type, null_type, array_type, object_type, nullable, enum_type, const_type, any_of, one_of, all_of, not_schema
- **Use cases:** LLM structured output validation, API response checking, config validation

See [docs/json_schema.md](docs/json_schema.md) for detailed documentation.

### Strings (`@stdlib/strings`)
**Status:** Complete

Expand Down Expand Up @@ -502,6 +517,7 @@ stdlib/
├── websocket.hml # WebSocket client/server (via libwebsockets FFI)
├── websocket_pure.hml # WebSocket pure Hemlock implementation (educational)
├── json.hml # JSON module (pure Hemlock)
├── json_schema.hml # JSON Schema validation (pure Hemlock)
├── strings.hml # String utilities module (pure Hemlock)
├── encoding.hml # Encoding module (pure Hemlock)
├── testing.hml # Testing framework (pure Hemlock)
Expand All @@ -519,6 +535,7 @@ stdlib/
├── http.md # HTTP API reference
├── websocket.md # WebSocket API reference
├── json.md # JSON API reference
├── json_schema.md # JSON Schema API reference
├── strings.md # Strings API reference
├── encoding.md # Encoding API reference
└── testing.md # Testing API reference
Expand Down Expand Up @@ -564,6 +581,7 @@ See `STDLIB_ANALYSIS_UPDATED.md` and `STDLIB_NETWORKING_DESIGN.md` for detailed
| http | ✅ Production (libwebsockets) | ✅ Complete | ✅ Good | 280 | High |
| websocket | ✅ Production (libwebsockets) | ✅ Complete | ✅ Good | 318 | High |
| json | ✅ Comprehensive | ✅ Complete | ✅ Good | 550+ | High |
| json_schema | ✅ Complete | ✅ Complete | ✅ Comprehensive | 400+ | High |
| strings | ✅ Complete | ✅ Complete | ✅ Comprehensive | 293 | High |
| encoding | ✅ Complete | ✅ Complete | ✅ Comprehensive | 370 | High |
| testing | ✅ Complete | ✅ Complete | ✅ Good | 410 | High |
Expand Down
5 changes: 3 additions & 2 deletions stdlib/docs/json.md
Original file line number Diff line number Diff line change
Expand Up @@ -649,14 +649,14 @@ try {

1. **No object iteration builtin** - `merge()`, `patch()`, and object `equals()` not yet implemented
2. **No line numbers in parse errors** - Validation doesn't report exact error location
3. **No JSON Schema** - Schema validation not yet supported
3. **JSON Schema** - See `@stdlib/json_schema` for schema validation
4. **No streaming** - Large files must fit in memory

## Future Enhancements

Planned additions:
- Object iteration support (enables merge/patch/equals)
- JSON Schema validation
- ~~JSON Schema validation~~ → See `@stdlib/json_schema`
- JSON Patch (RFC 6902)
- JSON Pointer (RFC 6901)
- Streaming parser for large files
Expand All @@ -667,4 +667,5 @@ Planned additions:
- Built-in `serialize()` method (CLAUDE.md - Objects section)
- Built-in `deserialize()` method (CLAUDE.md - Strings section)
- `@stdlib/fs` - File operations
- `@stdlib/json_schema` - JSON Schema validation
- `@stdlib/http` - HTTP requests with JSON
Loading
Loading