SlideShare a Scribd company logo
1 of 43
Download to read offline
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
JSON is weakly typed
{
“userName”: “Yos”,
“favouriteNumber”: 42,
“interests”: [“programming”, “swimming”]
}
message Person {
required string user_name = 1
optional int64 favourite_number = 2
repeated string interests = 3
}
Protocol Buffers are strongly typed
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" }
}
}
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
Yos Riady
yos.io
bit.ly/2JbMTrn
Q&A

More Related Content

What's hot

Centralized log-management-with-elastic-stack
Centralized log-management-with-elastic-stackCentralized log-management-with-elastic-stack
Centralized log-management-with-elastic-stackRich Lee
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep DiveAmazon Web Services
 
MongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesMongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesJared Rosoff
 
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)Elasticsearch
 
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - Demo
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - DemoServerless Databases - Amazon DynamoDB and Amazon Aurora Serverless - Demo
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - DemoAmazon Web Services
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation FrameworkCaserta
 
Nginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxwonyong hwang
 
Nginx internals
Nginx internalsNginx internals
Nginx internalsliqiang xu
 
Elastic search Walkthrough
Elastic search WalkthroughElastic search Walkthrough
Elastic search WalkthroughSuhel Meman
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataGregg Kellogg
 
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...Amazon Web Services
 
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인Amazon Web Services Korea
 
Spline: Data Lineage For Spark Structured Streaming
Spline: Data Lineage For Spark Structured StreamingSpline: Data Lineage For Spark Structured Streaming
Spline: Data Lineage For Spark Structured StreamingVaclav Kosar
 

What's hot (20)

Centralized log-management-with-elastic-stack
Centralized log-management-with-elastic-stackCentralized log-management-with-elastic-stack
Centralized log-management-with-elastic-stack
 
BDA311 Introduction to AWS Glue
BDA311 Introduction to AWS GlueBDA311 Introduction to AWS Glue
BDA311 Introduction to AWS Glue
 
Deep Dive on Amazon Aurora
Deep Dive on Amazon AuroraDeep Dive on Amazon Aurora
Deep Dive on Amazon Aurora
 
Introduction to Amazon DynamoDB
Introduction to Amazon DynamoDBIntroduction to Amazon DynamoDB
Introduction to Amazon DynamoDB
 
(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive(DAT401) Amazon DynamoDB Deep Dive
(DAT401) Amazon DynamoDB Deep Dive
 
AWS DynamoDB
AWS DynamoDBAWS DynamoDB
AWS DynamoDB
 
MongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - InboxesMongoDB Advanced Schema Design - Inboxes
MongoDB Advanced Schema Design - Inboxes
 
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)
Replicate Elasticsearch Data with Cross-Cluster Replication (CCR)
 
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - Demo
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - DemoServerless Databases - Amazon DynamoDB and Amazon Aurora Serverless - Demo
Serverless Databases - Amazon DynamoDB and Amazon Aurora Serverless - Demo
 
Become an AWS IAM Policy Ninja
Become an AWS IAM Policy NinjaBecome an AWS IAM Policy Ninja
Become an AWS IAM Policy Ninja
 
MongoDB Aggregation Framework
MongoDB Aggregation FrameworkMongoDB Aggregation Framework
MongoDB Aggregation Framework
 
Nginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptx
 
Yaml
YamlYaml
Yaml
 
Nginx internals
Nginx internalsNginx internals
Nginx internals
 
Elastic search Walkthrough
Elastic search WalkthroughElastic search Walkthrough
Elastic search Walkthrough
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
 
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
Migrate from Oracle to Aurora PostgreSQL: Best Practices, Design Patterns, & ...
 
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
Amazon Dynamo DB 활용하기 - 강민석 :: AWS Database Modernization Day 온라인
 
ElasticSearch
ElasticSearchElasticSearch
ElasticSearch
 
Spline: Data Lineage For Spark Structured Streaming
Spline: Data Lineage For Spark Structured StreamingSpline: Data Lineage For Spark Structured Streaming
Spline: Data Lineage For Spark Structured Streaming
 

Similar to Writing Domain Specific Languages with JSON Schema

json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college projectAmitSharma397241
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jacksonsrondal
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesBasics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesSanjeev Kumar Jaiswal
 
JSONSchema with golang
JSONSchema with golangJSONSchema with golang
JSONSchema with golangSuraj Deshmukh
 
Screaming fast json parsing on Android
Screaming fast json parsing on AndroidScreaming fast json parsing on Android
Screaming fast json parsing on AndroidKarthik Ramgopal
 
JSON Support in Salesforce - winter 12
JSON Support in Salesforce - winter 12JSON Support in Salesforce - winter 12
JSON Support in Salesforce - winter 12Jitendra Zaa
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Cloudera, Inc.
 
Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Gera Shegalov
 
Apache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big DataApache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big Datatechmaddy
 
NAVTechDays 2017 Json Meets NAV
NAVTechDays 2017 Json Meets NAVNAVTechDays 2017 Json Meets NAV
NAVTechDays 2017 Json Meets NAVGunnar Gestsson
 

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

Json
JsonJson
Json
 
Hands on JSON
Hands on JSONHands on JSON
Hands on JSON
 
json.ppt download for free for college project
json.ppt download for free for college projectjson.ppt download for free for college project
json.ppt download for free for college project
 
Json at work overview and ecosystem-v2.0
Json at work   overview and ecosystem-v2.0Json at work   overview and ecosystem-v2.0
Json at work overview and ecosystem-v2.0
 
Devoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and JacksonDevoxx - JSON Validation using JSON Schema and Jackson
Devoxx - JSON Validation using JSON Schema and Jackson
 
Basics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examplesBasics of JSON (JavaScript Object Notation) with examples
Basics of JSON (JavaScript Object Notation) with examples
 
MongoDB 3.0
MongoDB 3.0 MongoDB 3.0
MongoDB 3.0
 
Google Protocol Buffers
Google Protocol BuffersGoogle Protocol Buffers
Google Protocol Buffers
 
JSONSchema with golang
JSONSchema with golangJSONSchema with golang
JSONSchema with golang
 
Java script and json
Java script and jsonJava script and json
Java script and json
 
Intro to JSON
Intro to JSONIntro to JSON
Intro to JSON
 
Screaming fast json parsing on Android
Screaming fast json parsing on AndroidScreaming fast json parsing on Android
Screaming fast json parsing on Android
 
Json tutorial, a beguiner guide
Json tutorial, a beguiner guideJson tutorial, a beguiner guide
Json tutorial, a beguiner guide
 
JSON Support in Salesforce - winter 12
JSON Support in Salesforce - winter 12JSON Support in Salesforce - winter 12
JSON Support in Salesforce - winter 12
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)
 
Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013Apache Drill @ PJUG, Jan 15, 2013
Apache Drill @ PJUG, Jan 15, 2013
 
Apache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big DataApache big data 2016 - Speaking the language of Big Data
Apache big data 2016 - Speaking the language of Big Data
 
NAVTechDays 2017 Json Meets NAV
NAVTechDays 2017 Json Meets NAVNAVTechDays 2017 Json Meets NAV
NAVTechDays 2017 Json Meets NAV
 
Advanced Json
Advanced JsonAdvanced Json
Advanced Json
 
Json
JsonJson
Json
 

More from Yos Riady

Brief introduction to Serverless (2018)
Brief introduction to Serverless (2018)Brief introduction to Serverless (2018)
Brief introduction to Serverless (2018)Yos Riady
 
Type Checking in Javascript with Flow
Type Checking in Javascript with FlowType Checking in Javascript with Flow
Type Checking in Javascript with FlowYos Riady
 
Schema-First API Design
Schema-First API DesignSchema-First API Design
Schema-First API DesignYos Riady
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of RESTYos Riady
 
Python List Comprehensions
Python List ComprehensionsPython List Comprehensions
Python List ComprehensionsYos Riady
 
Ruby on Rails Workshop
Ruby on Rails WorkshopRuby on Rails Workshop
Ruby on Rails WorkshopYos Riady
 
Online Payments and You
Online Payments and YouOnline Payments and You
Online Payments and YouYos Riady
 
Entity Component Systems
Entity Component SystemsEntity Component Systems
Entity Component SystemsYos Riady
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to ReactYos Riady
 
Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIsYos Riady
 

More from Yos Riady (10)

Brief introduction to Serverless (2018)
Brief introduction to Serverless (2018)Brief introduction to Serverless (2018)
Brief introduction to Serverless (2018)
 
Type Checking in Javascript with Flow
Type Checking in Javascript with FlowType Checking in Javascript with Flow
Type Checking in Javascript with Flow
 
Schema-First API Design
Schema-First API DesignSchema-First API Design
Schema-First API Design
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
Python List Comprehensions
Python List ComprehensionsPython List Comprehensions
Python List Comprehensions
 
Ruby on Rails Workshop
Ruby on Rails WorkshopRuby on Rails Workshop
Ruby on Rails Workshop
 
Online Payments and You
Online Payments and YouOnline Payments and You
Online Payments and You
 
Entity Component Systems
Entity Component SystemsEntity Component Systems
Entity Component Systems
 
Introduction to React
Introduction to ReactIntroduction to React
Introduction to React
 
Intro to Web Map APIs
Intro to Web Map APIsIntro to Web Map APIs
Intro to Web Map APIs
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

Writing Domain Specific Languages with JSON Schema

  • 1.
  • 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
  • 4.
  • 5. JSON is weakly typed { “userName”: “Yos”, “favouriteNumber”: 42, “interests”: [“programming”, “swimming”] }
  • 6.
  • 7. message Person { required string user_name = 1 optional int64 favourite_number = 2 repeated string interests = 3 } Protocol Buffers are strongly typed
  • 8.
  • 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" } } }
  • 20.
  • 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
  • 41.
  • 42. Writing Domain Specific Languages with JSON Schema Yos Riady yos.io bit.ly/2JbMTrn
  • 43. Q&A