KEMBAR78
JSON Schema Design | PDF
JSON Schema
Design Mode
© 2021 Syncro Soft SRL. All rights reserved.
Octavian Nadolu, Syncro Soft
octavian.nadolu@oxygenxml.com
@OctavianNadolu
JSON Schema Design Mode
Agenda
● JSON Schema Support in Oxygen
● Create JSON Schema from Scratch
● Visualize and Edit Complex JSON Schemas
● Generate JSON Schema Documentation
JSON Schema Design Mode
JSON Schema
JSON Schema is a vocabulary that allows you to
annotate and validate JSON documents
http://json-schema.org
JSON Schema Design Mode
JSON Schema Definition
● It is recommended to to have the schema definition on the first level
"$schema": "http://json-schema.org/draft-07/schema#"
● JSON Schema used versions:
– draft-04
– draft-06
– draft-07
– draft/2020-12
JSON Schema Design Mode
Question: Do you use JSON Schema, what versions?
 No
 Yes. Draft 4, 6 or 7
 Yes. (2020-12)
 Yes. Other (use the Questions pane to
provide more details)
JSON Schema Design Mode
JSON Schema Support in Oxygen
● JSON Schema Editor - specialized editor with various editing features
● Validation against JSON Schema
● Editing based on JSON Schema
● Tools
– Generate JSON Schema Documentation
– Generate Sample JSON Files from a JSON Schema
– Generate JSON Schema from a JSON File
– XSD to JSON Schema Converter
JSON Schema Design Mode
JSON Schema Editor
Design, develop, and edit JSON Schemas in:
● Text Editing Mode
● Author Editing Mode
● Schema Design Mode
JSON Schema Design Mode
Text Editing Mode
Text editing mode is packed full of
editing helpers
● JSON Outline View
● JSON-specific Syntax Highlighting
● Search and Find/Replace
● Drag and Drop
● Validation
● Format and Indent (Pretty Print)
JSON Schema Design Mode
Author Editing Mode
Visual editing mode for JSON
Schema documents:
● JSON Schema framework
● Content completion support
● Validation
● Specific CSS for rendering
● Create your own custom JSON
framework
JSON Schema Design Mode
Schema Design Mode
Visualize, edit, and understand JSON Schemas
● In-Place Component Editing
● Edit Properties
● Edit Annotations
● Schema Editing Actions
● Move Component Up/Down Actions
● Print/Save as Image
JSON Schema Design Mode
Create JSON Schema from Scratch
● JSON-based product catalog
productID – the product identifier
productName – the product name
price – the selling price of the product
tags – an optional set of tags
{
"productId": 1,
"productName": "A green door",
"price": 12.50,
"tags": ["home","green"]
}
JSON Schema Design Mode
Create JSON Schema from Scratch
● productID – The identifier for a product
– Is a numeric value
– Is required
{
"productId": 1,
"productName": "A green door",
"price": 12.50,
"tags": ["home","green"]
}
JSON Schema Design Mode
Create JSON Schema from Scratch
● productName – The name of the product
– Is a string value
– Is required
{
"productId": 1,
"productName": "A green door",
"price": 12.50,
"tags": ["home","green"]
}
JSON Schema Design Mode
Create JSON Schema from Scratch
● price – The price of the product
– Is a number value
– Is required
– Must be greater that 0
{
"productId": 1,
"productName": "A green door",
"price": 12.50,
"tags": ["home","green"]
}
JSON Schema Design Mode
Create JSON Schema from Scratch
● tags – Tags for the product
– Is an array of string values
– Is not required
– At least one item in the array
– Must be unique relative to one another
{
"productId": 1,
"productName": "A green door",
"price": 12.50,
"tags": ["home","green"]
}
JSON Schema Design Mode
JSON Schema for Product Catalog
Easy to create a schema from scratch
● Use document template
● Edit the components in-place
● Edit the component properties in the in-
place view
● Add new components using the
append/insert contextual actions
● Change the documentation using the
Annotation dialog box
JSON Schema Design Mode
Schema Diagram Components
● schema – defines the root schema
component
● properties – defines a group of property
components
● definitions – contains a group of definition
components
● pattern properties – contains a group of
pattern property components
JSON Schema Design Mode
Schema Diagram Components
● property – defines a property declaration
● definition – contains a declaration of a
reusable definition
● pattern property – defines a pattern
property
● additional properties – contains a
definition for the additional properties
JSON Schema Design Mode
Schema Diagram Components- Arrays
● items – contains the array definition or
definitions
● Items definition – definition for all array
items
● Items array – an array of definitions, one
for each item from the array
● additional items – contains a definition for
the additional items from an array
JSON Schema Design Mode
Schema Diagram Components- Composition
● allOf – a list of definitions, data must be
valid against all definitions
● oneOf – a list of definitions, data must be
valid against exactly one of the definitions
● anyOf – a list of definitions, data must be
valid against any definition
● not – a definition, data must not be valid
against the given definition
JSON Schema Design Mode
Schema Diagram Components- Conditional
● if – contains a schema definition for the if
condition
● then – contains a schema definition, data
must be valid against it when the if
condition is true
● else – contains a schema definition, data
must be valid against it when the if
condition is false
JSON Schema Design Mode
Question: How do you use/intend to use JSON Schema?
 To define an API
 In a database
 To validate JSON documents
 Other (use the Questions pane to provide
more details)
JSON Schema Design Mode
Visualize and Edit Complex JSON Schemas
JSON Schema Design Mode
Visualize and Edit Complex JSON Schemas
● Smart navigation
● Zoom in/out
● Expand/Collapse components
● Go to references
● Go back and forward between components viewed or edited
● Validation markers
JSON Schema Design Mode
Generate JSON Schema Documentation
● Tool for generating detailed documentation for a JSON Schema file in
HTML format
JSON Schema Design Mode
JSON Schema Documentation
● Generate documentation in one file
or split into multiple files
● Option to include components details
● Display the diagram image for each
component
JSON Schema Design Mode
Conclusion
● Complete support for JSON Schemas
● JSON Schema Editor
● Validate JSON with JSON Schema
● Editing based on JSON Schema
● Useful JSON Schema Tools
JSON Schema Design Mode
Future Plans
● Improve JSON Schema Diagram
● Better JSON Schema Documentation
● Quick fixes for JSON problems
● OpenAPI support
● YAML support
JSON Schema Design Mode
Question: What features are the most important for you?
 JSON Schema Diagram
 JSON Schema Documentation
 Quick fixes for JSON problems
 OpenAPI support
 YAML support
JSON Schema Design Mode
Resources
● https://json-schema.org/
● oxygenxml.com/json_schema_editor.html
● oxygenxml.com/doc/ug-editor/topics/editing-JSON-schema.html
Video Demos:
● oxygenxml.com/demo/json_author.html
● oxygenxml.com/demo/json_tools.html
● oxygenxml.com/demo/json_validation.html
● oxygenxml.com/demo/json_editing.html
● oxygenxml.com/demo/json_query.html
Questions?
Octavian Nadolu
Product Manager at Syncro Soft
octavian.nadolu@oxygenxml.com
Twitter: @OctavianNadolu
LinkedIn: octaviannadolu

JSON Schema Design

  • 1.
    JSON Schema Design Mode ©2021 Syncro Soft SRL. All rights reserved. Octavian Nadolu, Syncro Soft octavian.nadolu@oxygenxml.com @OctavianNadolu
  • 2.
    JSON Schema DesignMode Agenda ● JSON Schema Support in Oxygen ● Create JSON Schema from Scratch ● Visualize and Edit Complex JSON Schemas ● Generate JSON Schema Documentation
  • 3.
    JSON Schema DesignMode JSON Schema JSON Schema is a vocabulary that allows you to annotate and validate JSON documents http://json-schema.org
  • 4.
    JSON Schema DesignMode JSON Schema Definition ● It is recommended to to have the schema definition on the first level "$schema": "http://json-schema.org/draft-07/schema#" ● JSON Schema used versions: – draft-04 – draft-06 – draft-07 – draft/2020-12
  • 5.
    JSON Schema DesignMode Question: Do you use JSON Schema, what versions?  No  Yes. Draft 4, 6 or 7  Yes. (2020-12)  Yes. Other (use the Questions pane to provide more details)
  • 6.
    JSON Schema DesignMode JSON Schema Support in Oxygen ● JSON Schema Editor - specialized editor with various editing features ● Validation against JSON Schema ● Editing based on JSON Schema ● Tools – Generate JSON Schema Documentation – Generate Sample JSON Files from a JSON Schema – Generate JSON Schema from a JSON File – XSD to JSON Schema Converter
  • 7.
    JSON Schema DesignMode JSON Schema Editor Design, develop, and edit JSON Schemas in: ● Text Editing Mode ● Author Editing Mode ● Schema Design Mode
  • 8.
    JSON Schema DesignMode Text Editing Mode Text editing mode is packed full of editing helpers ● JSON Outline View ● JSON-specific Syntax Highlighting ● Search and Find/Replace ● Drag and Drop ● Validation ● Format and Indent (Pretty Print)
  • 9.
    JSON Schema DesignMode Author Editing Mode Visual editing mode for JSON Schema documents: ● JSON Schema framework ● Content completion support ● Validation ● Specific CSS for rendering ● Create your own custom JSON framework
  • 10.
    JSON Schema DesignMode Schema Design Mode Visualize, edit, and understand JSON Schemas ● In-Place Component Editing ● Edit Properties ● Edit Annotations ● Schema Editing Actions ● Move Component Up/Down Actions ● Print/Save as Image
  • 11.
    JSON Schema DesignMode Create JSON Schema from Scratch ● JSON-based product catalog productID – the product identifier productName – the product name price – the selling price of the product tags – an optional set of tags { "productId": 1, "productName": "A green door", "price": 12.50, "tags": ["home","green"] }
  • 12.
    JSON Schema DesignMode Create JSON Schema from Scratch ● productID – The identifier for a product – Is a numeric value – Is required { "productId": 1, "productName": "A green door", "price": 12.50, "tags": ["home","green"] }
  • 13.
    JSON Schema DesignMode Create JSON Schema from Scratch ● productName – The name of the product – Is a string value – Is required { "productId": 1, "productName": "A green door", "price": 12.50, "tags": ["home","green"] }
  • 14.
    JSON Schema DesignMode Create JSON Schema from Scratch ● price – The price of the product – Is a number value – Is required – Must be greater that 0 { "productId": 1, "productName": "A green door", "price": 12.50, "tags": ["home","green"] }
  • 15.
    JSON Schema DesignMode Create JSON Schema from Scratch ● tags – Tags for the product – Is an array of string values – Is not required – At least one item in the array – Must be unique relative to one another { "productId": 1, "productName": "A green door", "price": 12.50, "tags": ["home","green"] }
  • 16.
    JSON Schema DesignMode JSON Schema for Product Catalog Easy to create a schema from scratch ● Use document template ● Edit the components in-place ● Edit the component properties in the in- place view ● Add new components using the append/insert contextual actions ● Change the documentation using the Annotation dialog box
  • 17.
    JSON Schema DesignMode Schema Diagram Components ● schema – defines the root schema component ● properties – defines a group of property components ● definitions – contains a group of definition components ● pattern properties – contains a group of pattern property components
  • 18.
    JSON Schema DesignMode Schema Diagram Components ● property – defines a property declaration ● definition – contains a declaration of a reusable definition ● pattern property – defines a pattern property ● additional properties – contains a definition for the additional properties
  • 19.
    JSON Schema DesignMode Schema Diagram Components- Arrays ● items – contains the array definition or definitions ● Items definition – definition for all array items ● Items array – an array of definitions, one for each item from the array ● additional items – contains a definition for the additional items from an array
  • 20.
    JSON Schema DesignMode Schema Diagram Components- Composition ● allOf – a list of definitions, data must be valid against all definitions ● oneOf – a list of definitions, data must be valid against exactly one of the definitions ● anyOf – a list of definitions, data must be valid against any definition ● not – a definition, data must not be valid against the given definition
  • 21.
    JSON Schema DesignMode Schema Diagram Components- Conditional ● if – contains a schema definition for the if condition ● then – contains a schema definition, data must be valid against it when the if condition is true ● else – contains a schema definition, data must be valid against it when the if condition is false
  • 22.
    JSON Schema DesignMode Question: How do you use/intend to use JSON Schema?  To define an API  In a database  To validate JSON documents  Other (use the Questions pane to provide more details)
  • 23.
    JSON Schema DesignMode Visualize and Edit Complex JSON Schemas
  • 24.
    JSON Schema DesignMode Visualize and Edit Complex JSON Schemas ● Smart navigation ● Zoom in/out ● Expand/Collapse components ● Go to references ● Go back and forward between components viewed or edited ● Validation markers
  • 25.
    JSON Schema DesignMode Generate JSON Schema Documentation ● Tool for generating detailed documentation for a JSON Schema file in HTML format
  • 26.
    JSON Schema DesignMode JSON Schema Documentation ● Generate documentation in one file or split into multiple files ● Option to include components details ● Display the diagram image for each component
  • 27.
    JSON Schema DesignMode Conclusion ● Complete support for JSON Schemas ● JSON Schema Editor ● Validate JSON with JSON Schema ● Editing based on JSON Schema ● Useful JSON Schema Tools
  • 28.
    JSON Schema DesignMode Future Plans ● Improve JSON Schema Diagram ● Better JSON Schema Documentation ● Quick fixes for JSON problems ● OpenAPI support ● YAML support
  • 29.
    JSON Schema DesignMode Question: What features are the most important for you?  JSON Schema Diagram  JSON Schema Documentation  Quick fixes for JSON problems  OpenAPI support  YAML support
  • 30.
    JSON Schema DesignMode Resources ● https://json-schema.org/ ● oxygenxml.com/json_schema_editor.html ● oxygenxml.com/doc/ug-editor/topics/editing-JSON-schema.html Video Demos: ● oxygenxml.com/demo/json_author.html ● oxygenxml.com/demo/json_tools.html ● oxygenxml.com/demo/json_validation.html ● oxygenxml.com/demo/json_editing.html ● oxygenxml.com/demo/json_query.html
  • 31.
    Questions? Octavian Nadolu Product Managerat Syncro Soft octavian.nadolu@oxygenxml.com Twitter: @OctavianNadolu LinkedIn: octaviannadolu