Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Clojure
  3. Prismatic's schema

Prismatic's schema

NOASSERTIONClojure

A Clojure(Script) library for declarative data description, validation, and coercion.

GitHubGitHub
2.5k stars252 forks0 contributors

What is Prismatic's schema?

Schema is a Clojure and ClojureScript library for declarative data description and validation. It provides a lightweight way to define the expected shape of data—like nested maps, lists, or specific value types—and validate that data matches those expectations. It solves the problem of unclear data contracts in Clojure codebases, making functions easier to understand and debug.

Target Audience

Clojure and ClojureScript developers working on teams or projects where data shape clarity, API robustness, and maintainability are important. It's especially useful for those building services, APIs, or applications with complex data flows.

Value Proposition

Developers choose Schema because it offers a simple, idiomatic way to document and validate data without the overhead of a full type system. Its seamless integration with Clojure, rich error messages, and powerful features like coercion and test data generation make it a practical tool for improving code quality.

Overview

Clojure(Script) library for declarative data description and validation

Use Cases

Best For

  • Documenting the expected shape of function inputs and outputs in Clojure
  • Validating data from external sources like JSON APIs or databases
  • Adding runtime type checking to Clojure applications without heavy tools
  • Coercing loosely-typed data (e.g., from HTTP requests) into domain-specific types
  • Generating test data from schemas for property-based testing
  • Improving team onboarding by making data contracts explicit and readable

Not Ideal For

  • Projects requiring compile-time type safety and static analysis, as Schema operates purely at runtime.
  • High-performance applications where validation overhead must be minimized, due to Schema's runtime checks.
  • Teams already using clojure.spec or core.typed extensively, since Schema might duplicate or conflict with those systems.
  • Scenarios with highly polymorphic or dynamic data shapes that are difficult to predefine with static schemas.

Pros & Cons

Pros

Idiomatic Data Description

Schemas are plain Clojure data structures that mirror your data, making them easy to read and write, as shown in examples like {:a {:b s/Str :c s/Int}}.

Rich Error Messages

Validation failures provide descriptive, programmer-friendly errors that pinpoint exact issues, such as 'not (instance? java.lang.String :b)' for type mismatches.

Seamless Function Integration

Macros like s/defn allow annotating function arguments and return values with schemas, enabling optional runtime validation without disrupting code flow.

Flexible Data Coercion

Schema can automatically transform input data, like converting JSON strings to keywords, using coercion matchers that simplify API handling.

Cons

Runtime Performance Overhead

Enabling validation adds computational cost at runtime, which can be significant in performance-critical paths, and requires careful management with features like s/validator.

No Compile-Time Guarantees

Unlike full type systems, Schema does not provide static type checking; errors are only caught at runtime, which might delay bug detection.

Experimental Features

Some utilities, such as data generation and partial datum completion, are labeled as experimental in the README, indicating they may be unstable or lack long-term support.

Frequently Asked Questions

Quick Stats

Stars2,461
Forks252
Contributors0
Open Issues25
Last commit2 months ago
CreatedSince 2013

Tags

#declarative-programming#functional-programming#clojurescript#schema-validation#api-documentation#clojure#data-validation

Built With

C
Clojure
C
ClojureScript

Included in

Clojure2.8k
Auto-fetched 18 hours ago

Related Projects

MalliMalli

High-performance data-driven data specification library for Clojure/Script.

Stars1,749
Forks238
Last commit2 months ago
OrchestraOrchestra

Complete instrumentation for clojure.spec

Stars625
Forks25
Last commit5 years ago
BouncerBouncer

A validation DSL for Clojure & Clojurescript applications

Stars361
Forks36
Last commit5 years ago
GuardrailsGuardrails

Efficient, hassle-free function call validation with a concise inline syntax for clojure.spec and Malli

Stars258
Forks26
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub