<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Hariharan Sharma</title>
    <description>The latest articles on Forem by Hariharan Sharma (@hariharan_sharma_d5247e0c).</description>
    <link>https://forem.com/hariharan_sharma_d5247e0c</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3906412%2Fc5358298-e64e-454e-94ce-dd5d7047f245.png</url>
      <title>Forem: Hariharan Sharma</title>
      <link>https://forem.com/hariharan_sharma_d5247e0c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hariharan_sharma_d5247e0c"/>
    <language>en</language>
    <item>
      <title>Building a JSON Schema Validator from Scratch (Part 1)</title>
      <dc:creator>Hariharan Sharma</dc:creator>
      <pubDate>Mon, 04 May 2026 17:25:52 +0000</pubDate>
      <link>https://forem.com/hariharan_sharma_d5247e0c/building-a-json-schema-validator-from-scratch-part-1-51lk</link>
      <guid>https://forem.com/hariharan_sharma_d5247e0c/building-a-json-schema-validator-from-scratch-part-1-51lk</guid>
      <description>&lt;h2&gt;
  
  
  The motive for this
&lt;/h2&gt;

&lt;p&gt;I wanted to go beyond surface-level understanding and actually get deep into JSON Schema and validator architecture from first principles.&lt;/p&gt;

&lt;p&gt;My goal is not just to use JSON Schema, but to understand how validators work internally so I can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build a JSON Schema validator from scratch&lt;/li&gt;
&lt;li&gt;Develop stronger schema design intuition&lt;/li&gt;
&lt;li&gt;Participate more meaningfully in JSON Schema community discussions&lt;/li&gt;
&lt;li&gt;Contribute to the JSON Schema ecosystem with actual technical depth instead of vague theory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This path was also inspired by advice from experienced community members, and honestly, it made perfect sense. If you want to contribute seriously, reading documentation casually is not enough. You need to understand the specification, implementation trade-offs, and architectural reasoning behind it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I have covered so far
&lt;/h2&gt;

&lt;p&gt;I started by revisiting the official JSON Schema getting started documentation to strengthen foundational concepts, then moved directly into the validation specification itself.&lt;/p&gt;

&lt;p&gt;Some of the more challenging but important concepts I explored include:&lt;/p&gt;

&lt;h3&gt;
  
  
  Interoperability considerations
&lt;/h3&gt;

&lt;p&gt;Understanding how validators must behave consistently across programming languages, especially around:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Arbitrary precision numbers&lt;/li&gt;
&lt;li&gt;String validation edge cases&lt;/li&gt;
&lt;li&gt;Regular expression portability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is critical because building a validator means thinking beyond language-specific limitations.&lt;/p&gt;

&lt;h3&gt;
  
  
  Meta-schema and dialect bootstrapping
&lt;/h3&gt;

&lt;p&gt;One of the most important concepts was understanding that before validating JSON instances, validators must first validate schemas themselves through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;$schema&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;$vocabulary&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Draft compatibility&lt;/li&gt;
&lt;li&gt;Meta-schema validation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This completely changed how I view schema loading and validator initialization.&lt;/p&gt;

&lt;h3&gt;
  
  
  Validation keyword mechanics
&lt;/h3&gt;

&lt;p&gt;I explored deeper validation behavior for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;minimum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maximum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclusiveMinimum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;exclusiveMaximum&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;multipleOf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;contains&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;minContains&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maxContains&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Especially array counting logic and numeric correctness, which are far more nuanced than they initially appear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Specification architecture
&lt;/h3&gt;

&lt;p&gt;Rather than treating documentation like reference material, I am approaching it as implementation blueprints.&lt;/p&gt;

&lt;p&gt;This means understanding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why certain design decisions exist&lt;/li&gt;
&lt;li&gt;Where interoperability breaks&lt;/li&gt;
&lt;li&gt;Practical compromises used by existing validators like AJV&lt;/li&gt;
&lt;li&gt;How vocabulary systems future-proof the specification&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why this matters for building a validator from scratch
&lt;/h2&gt;

&lt;p&gt;This process is helping me create a proper roadmap for implementation, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parsing schemas&lt;/li&gt;
&lt;li&gt;Meta-schema validation&lt;/li&gt;
&lt;li&gt;Vocabulary support&lt;/li&gt;
&lt;li&gt;Accurate numeric validation&lt;/li&gt;
&lt;li&gt;Regex safety&lt;/li&gt;
&lt;li&gt;Schema compilation strategies&lt;/li&gt;
&lt;li&gt;Standards compliance&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of blindly coding features, I am building an architectural understanding first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Long-term vision
&lt;/h2&gt;

&lt;p&gt;These docs will serve as ongoing reference points throughout development.&lt;/p&gt;

&lt;p&gt;I plan to repeatedly return to them while implementing each validator component so that my project aligns as closely as possible with real specification behavior.&lt;/p&gt;

&lt;p&gt;Beyond the project itself, this journey is preparing me to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contribute to JSON Schema discussions&lt;/li&gt;
&lt;li&gt;Understand validator ecosystem limitations&lt;/li&gt;
&lt;li&gt;Build better tooling&lt;/li&gt;
&lt;li&gt;Potentially contribute directly to JSON Schema implementations or specification conversations&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;It is slower, more technical, and occasionally absurdly dense, but it is also one of the best ways to develop genuine expertise rather than shallow framework familiarity.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>learning</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
