SlideShare a Scribd company logo
Writing Domain Specific Languages with JSON Schema
Writing Domain Specific Languages
with JSON Schema
Yos Riady
yos.io
bit.ly/2JbMTrn
Weak types in JSON
What is JSON Schema?
Introduction Schema Uses DSL Conclusion
JSON Schema use
cases
Summary and further
learning
Writing a DSL with
JSON Schema
Writing Domain Specific Languages with JSON Schema
JSON is weakly typed
{
“userName”: “Yos”,
“favouriteNumber”: 42,
“interests”: [“programming”, “swimming”]
}
Writing Domain Specific Languages with JSON Schema
message Person {
required string user_name = 1
optional int64 favourite_number = 2
repeated string interests = 3
}
Protocol Buffers are strongly typed
Writing Domain Specific Languages with JSON Schema
How can we validate
JSON data with types?
Enter JSON Schema
{
“userName”: { “type”: “string” },
“favouriteNumber”: { “type”: “integer” },
“interests”: { “type”: “array”, “items”: { “type”: “string”} }
}
JSON Schema helps you validate
JSON data.
jsonschemalint.com
JSON Schema 101
{
"type": "string"
}
Valid Invalid
“foo” 123
false
JSON Schema Basic Types
● string
● Numeric types
● object
● array
● boolean
● null
{
"type": "object",
"properties": {
"userName": {
"type": "string"
}
},
"required": ["userName"],
"additionalProperties": false,
}
JSON Schema 101 Valid Invalid
{
“userName”:
“foo”
}
{
“userName”: 1
}
{
“name”: “foo”
}
{}
JSON Schema 101
Invalid Validation Message
{
“userName”: 1
}
Field .userName should be a string
{
“name”: “foo”
}
Should NOT have additional properties
{} Should have required property ‘userName’
Additional JSON Schema Validations
{
"type": "number",
"minimum": 0,
"maximum": 100,
"exclusiveMaximum": true
}
{
"type": "string",
"pattern": "^(([0-9]{3}))?[0-9]{3}-[0-9]{4}$"
}
Combining JSON Schemas
● AnyOf
● AllOf
● OneOf
● not
{
"anyOf": [
{ "type": "string" },
{ "type": "number" }
]
}
Structuring Complex Schemas
{
"definitions": {
"person": { ... }
},
"type": "object",
"properties": {
"user": { "$ref": "#/definitions/person" }
}
}
Writing Domain Specific Languages with JSON Schema
jsonschemalint.com
Use Cases for JSON Schema
● Message / data validation
○ Object Relational Mappers (ORMs)
● Schemaless objects in Web Applications
● Content Management in Headless CMSes
● Writing Specification Languages
○ OpenAPI / Swagger
○ AWS States Language
○ WAML
Hapi.js object validation
Dynamic forms
Content Modeling in Headless CMSes
Content Modeling in Headless CMSes
Writing Specification Languages
Weak types in JSON
What is JSON Schema?
Introduction Schema Uses DSL Conclusion
JSON Schema use
cases
Summary and further
learning
Writing a DSL with
JSON Schema
Writing a DSL with JSON Schema
Domain Specific Languages
● Computer language specialized to a particular application domain
○ In contrast to General Purpose Languages (GPLs)
OpenAPI / Swagger
Web Automation Markup Language (waml.io)
waml.io/editor
Writing a DSL with JSON Schema
"waml": {
"description": "WAML Specification semantic version number.",
"type": "string",
"pattern": "^([0-9]{1,}.[0-9]{1,}.[0-9]{1,})$",
"enum": ["0.1.0"]
}
Writing a DSL with JSON Schema
"steps": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/definitions/Step"
}
}
Writing a DSL with JSON Schema
"Step": {
"type": "object",
"description": "A step represents a single user interaction.",
"oneOf": [
{
"$ref": "#/definitions/VisitStep"
},
{
"$ref": "#/definitions/ClickStep"
}
]
}
"ClickStep": {
"type": "object",
"properties": {
"click": {
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"selector": { "type": "string" },
"index": { "type": "integer", "minimum": 0 }
}
}
]
},
},
}
github.com/waml-lang/waml
Weak types in JSON
What is JSON Schema?
Introduction Schema Uses DSL Conclusion
JSON Schema use
cases
Summary and further
learning
Writing a DSL with
JSON Schema
● JSON is weakly typed
● JSON Schema
○ What is JSON Schema?
○ JSON validation with JSON Schema
○ Use cases
● Domain Specific Languages
○ What are DSLs?
○ Writing a DSL with JSON Schema
In Closing
Writing Domain Specific Languages with JSON Schema
Writing Domain Specific Languages
with JSON Schema
Yos Riady
yos.io
bit.ly/2JbMTrn
Q&A

More Related Content

PPT
C Structures And Unions
PPT
Processing XML with Java
PPT
DOM and SAX
PDF
JavaScript - Chapter 8 - Objects
PPTX
Event Handling in JAVA
PPTX
Java history 01
PPTX
C Structures And Unions
Processing XML with Java
DOM and SAX
JavaScript - Chapter 8 - Objects
Event Handling in JAVA
Java history 01

What's hot (20)

PDF
Introduction to JSON
PPTX
Android Widget
PDF
PostgreSQL: How to Store Passwords Safely
PPTX
Python programming: Anonymous functions, String operations
PPTX
Django Architecture Introduction
PPTX
Arrays in java language
PPTX
Java Hello World Program
PPTX
Classes objects in java
PPT
Javascript built in String Functions
PPT
Java awt
PPTX
Debugging Python with Pdb!
PDF
Java String
PPTX
Java swing
PDF
StringTokenizer in java
PPT
Network programming in Java
PPTX
Windows form application_in_vb(vb.net --3 year)
PPTX
Properties and indexers in C#
PPTX
PHP Course (Basic to Advance)
PPT
Arrays Basics
PPTX
Java History
Introduction to JSON
Android Widget
PostgreSQL: How to Store Passwords Safely
Python programming: Anonymous functions, String operations
Django Architecture Introduction
Arrays in java language
Java Hello World Program
Classes objects in java
Javascript built in String Functions
Java awt
Debugging Python with Pdb!
Java String
Java swing
StringTokenizer in java
Network programming in Java
Windows form application_in_vb(vb.net --3 year)
Properties and indexers in C#
PHP Course (Basic to Advance)
Arrays Basics
Java History
Ad

Similar to Writing Domain Specific Languages with JSON Schema (20)

PDF
Json
PDF
Hands on JSON
PPT
json.ppt download for free for college project
PDF
Json at work overview and ecosystem-v2.0
KEY
Devoxx - JSON Validation using JSON Schema and Jackson
PPTX
Introduction to JavaScript Object Notation(JSON)
PDF
Basics of JSON (JavaScript Object Notation) with examples
PPTX
MongoDB 3.0
PPTX
Google Protocol Buffers
PDF
JSONSchema with golang
PPTX
Java script and json
PPTX
Intro to JSON
PPTX
Screaming fast json parsing on Android
PPTX
LU 1.3. JSON & XML.pptx about how they work and introduction
PDF
YAML crash COURSE how to write yaml file for adding configuring details
PDF
Json tutorial, a beguiner guide
PPTX
JSON Support in Salesforce - winter 12
PDF
Apache AVRO (Boston HUG, Jan 19, 2010)
PDF
Apache Drill @ PJUG, Jan 15, 2013
PDF
Apache big data 2016 - Speaking the language of Big Data
Json
Hands on JSON
json.ppt download for free for college project
Json at work overview and ecosystem-v2.0
Devoxx - JSON Validation using JSON Schema and Jackson
Introduction to JavaScript Object Notation(JSON)
Basics of JSON (JavaScript Object Notation) with examples
MongoDB 3.0
Google Protocol Buffers
JSONSchema with golang
Java script and json
Intro to JSON
Screaming fast json parsing on Android
LU 1.3. JSON & XML.pptx about how they work and introduction
YAML crash COURSE how to write yaml file for adding configuring details
Json tutorial, a beguiner guide
JSON Support in Salesforce - winter 12
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache Drill @ PJUG, Jan 15, 2013
Apache big data 2016 - Speaking the language of Big Data
Ad

More from Yos Riady (10)

PDF
Brief introduction to Serverless (2018)
PDF
Type Checking in Javascript with Flow
PDF
Schema-First API Design
PDF
GraphQL in an Age of REST
PDF
Python List Comprehensions
PDF
Ruby on Rails Workshop
PDF
Online Payments and You
PDF
Entity Component Systems
PDF
Introduction to React
PPTX
Intro to Web Map APIs
Brief introduction to Serverless (2018)
Type Checking in Javascript with Flow
Schema-First API Design
GraphQL in an Age of REST
Python List Comprehensions
Ruby on Rails Workshop
Online Payments and You
Entity Component Systems
Introduction to React
Intro to Web Map APIs

Recently uploaded (20)

PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
System and Network Administraation Chapter 3
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
medical staffing services at VALiNTRY
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPT
Introduction Database Management System for Course Database
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Navsoft: AI-Powered Business Solutions & Custom Software Development
Upgrade and Innovation Strategies for SAP ERP Customers
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
System and Network Administraation Chapter 3
Design an Analysis of Algorithms I-SECS-1021-03
medical staffing services at VALiNTRY
How to Choose the Right IT Partner for Your Business in Malaysia
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Introduction Database Management System for Course Database
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 41
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Which alternative to Crystal Reports is best for small or large businesses.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Writing Domain Specific Languages with JSON Schema

  • 2. Writing Domain Specific Languages with JSON Schema Yos Riady yos.io bit.ly/2JbMTrn
  • 3. Weak types in JSON What is JSON Schema? Introduction Schema Uses DSL Conclusion JSON Schema use cases Summary and further learning Writing a DSL with JSON Schema
  • 5. JSON is weakly typed { “userName”: “Yos”, “favouriteNumber”: 42, “interests”: [“programming”, “swimming”] }
  • 7. message Person { required string user_name = 1 optional int64 favourite_number = 2 repeated string interests = 3 } Protocol Buffers are strongly typed
  • 9. How can we validate JSON data with types?
  • 10. Enter JSON Schema { “userName”: { “type”: “string” }, “favouriteNumber”: { “type”: “integer” }, “interests”: { “type”: “array”, “items”: { “type”: “string”} } }
  • 11. JSON Schema helps you validate JSON data.
  • 13. JSON Schema 101 { "type": "string" } Valid Invalid “foo” 123 false
  • 14. JSON Schema Basic Types ● string ● Numeric types ● object ● array ● boolean ● null
  • 15. { "type": "object", "properties": { "userName": { "type": "string" } }, "required": ["userName"], "additionalProperties": false, } JSON Schema 101 Valid Invalid { “userName”: “foo” } { “userName”: 1 } { “name”: “foo” } {}
  • 16. JSON Schema 101 Invalid Validation Message { “userName”: 1 } Field .userName should be a string { “name”: “foo” } Should NOT have additional properties {} Should have required property ‘userName’
  • 17. Additional JSON Schema Validations { "type": "number", "minimum": 0, "maximum": 100, "exclusiveMaximum": true } { "type": "string", "pattern": "^(([0-9]{3}))?[0-9]{3}-[0-9]{4}$" }
  • 18. Combining JSON Schemas ● AnyOf ● AllOf ● OneOf ● not { "anyOf": [ { "type": "string" }, { "type": "number" } ] }
  • 19. Structuring Complex Schemas { "definitions": { "person": { ... } }, "type": "object", "properties": { "user": { "$ref": "#/definitions/person" } } }
  • 22. Use Cases for JSON Schema ● Message / data validation ○ Object Relational Mappers (ORMs) ● Schemaless objects in Web Applications ● Content Management in Headless CMSes ● Writing Specification Languages ○ OpenAPI / Swagger ○ AWS States Language ○ WAML
  • 25. Content Modeling in Headless CMSes
  • 26. Content Modeling in Headless CMSes
  • 28. Weak types in JSON What is JSON Schema? Introduction Schema Uses DSL Conclusion JSON Schema use cases Summary and further learning Writing a DSL with JSON Schema
  • 29. Writing a DSL with JSON Schema
  • 30. Domain Specific Languages ● Computer language specialized to a particular application domain ○ In contrast to General Purpose Languages (GPLs)
  • 32. Web Automation Markup Language (waml.io)
  • 34. Writing a DSL with JSON Schema "waml": { "description": "WAML Specification semantic version number.", "type": "string", "pattern": "^([0-9]{1,}.[0-9]{1,}.[0-9]{1,})$", "enum": ["0.1.0"] }
  • 35. Writing a DSL with JSON Schema "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/Step" } }
  • 36. Writing a DSL with JSON Schema "Step": { "type": "object", "description": "A step represents a single user interaction.", "oneOf": [ { "$ref": "#/definitions/VisitStep" }, { "$ref": "#/definitions/ClickStep" } ] }
  • 37. "ClickStep": { "type": "object", "properties": { "click": { "oneOf": [ { "type": "string" }, { "type": "object", "properties": { "selector": { "type": "string" }, "index": { "type": "integer", "minimum": 0 } } } ] }, }, }
  • 39. Weak types in JSON What is JSON Schema? Introduction Schema Uses DSL Conclusion JSON Schema use cases Summary and further learning Writing a DSL with JSON Schema
  • 40. ● JSON is weakly typed ● JSON Schema ○ What is JSON Schema? ○ JSON validation with JSON Schema ○ Use cases ● Domain Specific Languages ○ What are DSLs? ○ Writing a DSL with JSON Schema In Closing
  • 42. Writing Domain Specific Languages with JSON Schema Yos Riady yos.io bit.ly/2JbMTrn
  • 43. Q&A