GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - staciax/vivian-v0: Swift-based data validation library.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.zed
.zed
 
 
Scripts
Scripts
 
 
Sources/Vivian
Sources/Vivian
 
 
Tests/VivianTests
Tests/VivianTests
 
 
.gitignore
.gitignore
 
 
.swift-format
.swift-format
 
 
CHECKLIST.md
CHECKLIST.md
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
diagram.md
diagram.md
 
 

Repository files navigation

Vivian

"Make data safe. Just let it validate."

A Swift-based library for data validation and parsing. It helps you validate inputs, sanitize fields, and decode them into type-safe models, structured exactly the way you want.


This is the 3rd project for the Swift Programming course, created to apply the fundamentals learned in the course.

It follows a strict, course-defined scope (see CHECKLIST.md for exact requirements).

Due to the submission deadline on April 17, 2026, some parts may be incomplete or experimental.

The project covers the following topics:

  • Extensions
  • Protocols
  • Generics
  • Opaque and Boxed Protocol Types
  • Automatic Reference Counting
  • Memory Safety
  • Access Control
  • Advanced Operators

Inspiration

Vivian is heavily inspired by Pydantic — my personal favorite Python library. Most of the architecture is adapted from pydantic-core, rewritten for Swift's type system.

Started with Property Wrappers to mimic Pydantic's field syntax, but var-only stored properties made it awkward. Switched to Result Builders — more declarative, though full type-safety within the course scope got complicated fast. The API is still evolving and may change over time.

Prerequisites

  • Swift 6.2+
  • macOS 13+ (for Regex support)

Running the project

  1. Clone the repository
git clone https://github.com/staciax/vivian-v0.git
  1. Build the package
swift build
  1. Run tests
swift test

Quick Example

import Foundation

struct User: Codable {
    let id: UUID
    let name: String
    let email: String
    let createdAt: Date
}

let schema = ObjectSchema<User> {
    Field(\.id, version: .v7)
    Field(
        \.name,
        minLength: 1,
        maxLength: 50,
        trim: true,
        toLowercase: true,
        before: { value in
            if let s = value as? String {
                return s + " (uwu)"
            }
            return value
        },
        after: {
            value in
            return value.replacingOccurrences(of: "(uwu)", with: "(owo)")
        }
    )
    Field(\.email, format: .email)
    Field(\.createdAt, format: .iso8601)
}

let jsonData = """
{
    "id": "019d9aa8-ee5f-7f39-998f-de8f1fd945b2",
    "name": "STAC/A",
    "email": "[email protected]",
    "createdAt": 1776390743
}""".data(using: .utf8)!

let user = try schema.validate(jsonData)
print(user.id)          // 019D9AA8-EE5F-7F39-998F-DE8F1FD945B2
print(user.name)        // stac/a (owo)
print(user.email)       // [email protected]
print(user.createdAt)   // 2057-04-17 01:52:23 +0000

// maybe timezone is broken :)

License & Copyright

This repository is a prototype developed for an academic project.

All rights reserved.

No permission is granted to use, copy, modify, or distribute this source code, in whole or in part, without explicit prior written consent.

This repository is provided for viewing and educational purposes only. It is not intended for production use.

Appreciation

A heartfelt thank you to my professor for the guidance and support throughout these years.

From Object-Oriented Programming and Design Patterns to Swift, your teaching has shaped the way I approach software and problem-solving. I’m truly grateful to have learned from you — it’s been a meaningful part of my journey as a developer.

I just want to say thank you. It really means a lot. <3

About

Swift-based data validation library.

Topics

data-validationswiftswift6

Resources

Readme
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.