Software Project Health Check: Best Practices and Techniques for Your Product...
Leveraging Model-Driven Technologies for JSON
1. Leveraging Model-Driven
Technologies for JSON Artefacts:
The Shipyard Case Study
Alessandro Colantoni, Antonio Garmendia, Luca Berardinelli, Manuel Wimmer
Institute for Business Informatics – Software Engineering Johannes Kepler University, Linz, Austria
Johannes Bräuer
Dynatrace GmbH, Linz
MODELS 2021, Practice and Innovation Track, Oct 14th, 2021 (virtual)
2. Outline
◦Context:
▪ JSON & JSON Schema
▪ Use Case Scenarios
◦MDE for JSON/JSON Schema:
▪ Bridging Approach steps in details
▪ Case study in DevOps domain: Keptn and Shipyard DSL
◦Conclusions and Future Work
2
3. Context: JSON and JSON Schema
• JSON is an open, textual, human readable data
serialization format (.json) with a wide range of application,
primarily used in data exchange Web scenarios
[1] IETF, “JSON Schema Draft 2020-12,” https://json-schema.org/draft/ 2020-12/json-schema-core.html, accessed: 2021-19-02.
[2] JSON Schema meta-schema: https://json-schema.org/draft-07/schema
{
"name": "Alessandro",
"surname": "Colantoni",
"affiliation": {
"universityName": "Johannes Kepler University",
"city": "Linz"
},
"contacts": [
{"email": "alessandro.colantoni@jku.at"},
{"phone": "+4373224684248"},
]
} .json
“name” : “value” pairs
[array]
{object}
JSON document / schema instance
JSON document / schema
• JSON Schema is a draft standard issued by IETF.
A schema is “a JSON media type for defining the structure
of JSON data. JSON Schema is intended to define
validation, documentation, hyperlink navigation, and
interaction control of JSON data.” [1]
{
"$schema": "http://json-schema.org/draft-07/schema#"
"type":"object",
"properties":{
"name":{"type":"string},
"surname":{"type":"string}
},
"additionalProperties":true
} .json
Reference to JSON Schema draft standard
contacts array property not foreseen but is allowed!
• IETF publishes a JSON Schema Draft [2] every 6 months
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://json-schema.org/draft-07/schema#",
"title": "Core schema meta-schema",
…
} .json
JSON document / (meta)schema instance
JSON document / (meta)schema
Defined by itself
3
4. Context: Actors and Use Cases
Metaschema Specification
Tool Support
Domain-specific Activities
(schemas and schema instances)
Tool
Provider(s)
Domain
Expert(s)
Data/Language
Engineer(s)
Schema Specification
Managing (meta)schemas and schema instances. Typical
tools include editors, parsers, validators, “utilities”…
Data Engineers define data structures. JSON
Schema is used also for defining the structure of
“scripting languages”.
JSON users needing JSON for their
domain. This is the largest category.
IETF is issuing and maintaining metaschema drafts, i.e., IETF.
https://json-schema.org/implementations.html
JSON users
schema instance
c2
metaschema
c2
schema
Now…
Meta-Language
Engineer
4
6. Contributions: Modeling and Validation Support (2)
Metaschema Specification
Tool Support
Domain-specific Activities
(schemas and schema instances)
Tool
Provider(s)
Domain
Expert(s)
Data/Language
Engineer(s)
Schema Specification
JSON users
schema instance
c2
metaschema
c2
schema
JSONware TS
M3
M2
M1
1
Modelware TS
model
c2
metalanguage
c2
metamodel
M3
M2
M1
Enabling Modelware-native Tool Support in addition to JSONware one,
thanks to tool support generarion capabilities of language workbenches.
(Meta)Language Engineers become potential Tool Providers
Modelware-native Support
«extend»
Validation
Support
Modeling
Support
«extend»
«extend»
«include»
«include»
Consistency Checking
Support
«include»
2
2
…After
Meta-Language
Engineer
Colantoni, B. Horvath, A. Horvath, L. Berardinelli, and M. Wimmer,
“Towards Continuous Consistency Checking of DevOps Artefacts,”
in Proceedings of the 24rd ACM/IEEE International Conference on Model Driven Engineering
Languages and Systems: Companion Proceedings, 2021, p. 6.
6
@DevOps 2021 (Monday)
7. Contributions: Transparent to JSON users (3)
Metaschema Specification
Tool Support
Domain-specific Activities
(schemas and schema instances)
Tool
Provider(s)
Domain
Expert(s)
Data/Language
Engineer(s)
Schema Specification
JSON users
schema instance
c2
metaschema
c2
schema
MDE users
JSONware TS
M3
M2
M1
1
Modelware TS
model
c2
metalanguage
c2
metamodel
M3
M2
M1
«include»
Transparent Approach for JSON users, typically MDE-agnostic,
by adopting JSON textual concrete syntax
3
…After
Meta-Language
Engineer
JSONware-native
support
3
Modelware-native Support
«extend»
Validation
Support
Modeling
Support
«extend»
«extend»
«include»
«include»
Consistency Checking
Support
«include»
2
7
Colantoni, B. Horvath, A. Horvath, L. Berardinelli, and M. Wimmer,
“Towards Continuous Consistency Checking of DevOps Artefacts,”
in Proceedings of the 24rd ACM/IEEE International Conference on Model Driven Engineering
Languages and Systems: Companion Proceedings, 2021, p. 6.
@DevOps 2021 (Monday)
8. Case Study Scenario: Shipyard DSL for Keptn (CD)
Metaschema Specification
Tool Support
Continuous Delivery Workflow
Specification (DevOps)
Tool
Provider(s)
Domain
Expert(s)
Meta-Language
Engineer
Data/Language
Engineer(s)
Schema Specification
JSON users
schema instance
c2
metaschema
c2
schema
MDE users
JSONware TS
M3
M2
M1
1
Modelware TS
model
c2
metalanguage
c2
metamodel
M3
M2
M1
is an open-source project for orchestrating continuous delivery (CD)
and operational processes of cloud-native applications
https://keptn.sh/
JSONware-native
support
3
Modelware-native Support
«extend»
Validation
Support
Modeling
Support
«extend»
«extend»
«include»
«include»
Consistency Checking
Support
«include»
2
«include»
8
Colantoni, B. Horvath, A. Horvath, L. Berardinelli, and M. Wimmer,
“Towards Continuous Consistency Checking of DevOps Artefacts,”
in Proceedings of the 24rd ACM/IEEE International Conference on Model Driven Engineering
Languages and Systems: Companion Proceedings, 2021, p. 6.
@DevOps 2021 (Monday)
9. Bridging JSONware/Modelware in Details
• 8 steps across meta layers (domain
independent/specific)
• Different stakeholders / different views
• Metalanguage Engineers (i.e., IETF) perform
manual steps
• Other stakeholders enjoy automation via
novel transformations (JsonSchema2Ecore)
and existing ones (e.g., Ecore2Xtext)
• Supporting Technologies:
EMF, Xtext, ATL, Xtend
: 7-8
Domain
Expert(s)
Tool
Provider(s)
Language
Engineer(s)
: 2,6
: 3-6
Meta-Language
Engineer
: 1-2
metaschema
JSONware
c2
Ecore
metalanguage
c2
metaschema
metamodel
Modelware (via EMF)
c2
Xtext
metagrammar
c2
metaschema
grammar
1
2
M3
M2
M1 document
(schema instance)
c2
schema
c2
schema
schema
metamodel
schema
grammar
document
model
schema
model
c2
c2
4
5
6
7
8
3
c2
schema
schema
model
c2
4
3
schema
metamodel
schema
grammar
5
6
document
(schema instance)
document
model
7
8
domain-specific
domain-independent
9
Let’s introduce it step by step
15. Approach: Modeling/Validating CD Workflow in Shipyard
metaschema
JSONware
c2
Ecore
metalanguage
c2
metaschema
metamodel
Modelware (via EMF)
c2
Xtext
metagrammar
c2
metaschema
grammar
1
2
M3
M2
M1
• Step 7: Modeling your own JSON document
as JSON schema instance
• Step 8: By construction compatibility with
JSONware (you are indeed editing in JSON
document
(schema instance)
c2
schema
c2
schema
schema
metamodel
schema
grammar
document
model
schema
model
c2
c2
4
5
6
7
8
3
c2
schema
schema
model
c2
4
3
schema
metamodel
schema
grammar
5
6
Continuous Delivery Workflow in Shipyard
7
8
domain-specific
domain-independent
: 7-8
Domain
Expert(s)
15
Modeling and Validation
+ OCL
+ OCL
+ OCL
document
model
document
(schema instance)
16. Practical Impact for DevOps Experts using Keptn.
RQ1: Is our approach capable of presenting
the different versions of the Shipyard
language initially defined with JSON
Schema?
Yes, we applied the approach for
4 Shipyard DSL versions so far.
RQ2: As the Shipyard language is subject to
evolution, can we support the co-evolution
of existing DevOps workflows?
Yes, we pave the way to co-evolution support
classifying changes in conformance
breaking/non-breaking changes.
16
17. Conclusions and Future Work
• We presented a bridge between JSONware and Modelware
(via Eclipse-based technologies)
• Goal: bringing the benefits of model-driven technologies to JSONware
• We concentrated on Modeling and Validation. Consistency Management
across JSON artefacts have been presented at DevOps workshop
• We are going to collect and analyse feedback from Keptn community to
assess the introduction of MDE to an MDE-agnostic community
17
18. Leveraging Model-Driven
Technologies for JSON Artefacts:
The Shipyard Case Study
Alessandro Colantoni, Antonio Garmendia, Luca Berardinelli, Manuel Wimmer
Institute for Business Informatics – Software Engineering Johannes Kepler University, Linz, Austria
Johannes Bräuer
Dynatrace GmbH, Linz
MODELS 2021, Practice and Innovation Track, Oct 14th, 2021 (virtual)
Thanks for your attention
Question Time
19. On JSONSchema2Ecore Transformation
Is bidirectional?
MDE Expert viewpoint: No.
• We provide a JSON Schema to Ecore transformation
• We do not provide (yet) an Ecore to JSON Schema. An arbitrary Ecore cannot be
transformed into JSON Schema
JSON Schema Expert (MDE agnostic) viewpoint: n.a.
• She/he is an unaware modeler thanks JSON Native concrete syntax preserved.
19
20. Context: JSON and JSON Schema
• Additional Properties: true
In this case any JSON fragment can be attached to a
schema instance.
We created the JSONDocumentFragment for this purpose,
to support validation of such JSON fragments within our
Xtext-based editors.
{
"name": "Alessandro",
"surname": "Colantoni“,
"affiliation": {
"universityName": "Johannes Kepler University",
"city": "Linz"
},
"contacts": [
{"email": "alessandro.colantoni@jku.at"},
{"phone": "+4373224684248"},
]
} .json
“name” : “value” pairs
[array]
{object}
JSON document / schema instance
JSON document / schema
{
"$schema": "http://json-schema.org/draft-07/schema#"
"type":"object",
"properties":{
"name":{"type":"string},
"surname":{"type":"string}
},
"additionalProperties":true
} .json
Reference to JSON Schema draft standard
contacts array property not foreseen but is allowed!
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://json-schema.org/draft-07/schema#",
"title": "Core schema meta-schema",
…
} .json
JSON document / (meta)schema instance
JSON document / (meta)schema
Defined by itself
20