Skip to content

Commit bb02059

Browse files
committed
docs: add SDK, VS Code extension, and Structurize sections to primer
- Enhanced introduction with Avro comparison and value proposition - Added Section 8: SDK and Tooling Ecosystem with install commands for all 7 languages - Added Section 9: Visual Studio Code Extension features - Added Section 10: Structurize schema conversion and code generation - Added Section 11: Resources and Next Steps with consolidated links - Fixed typo in alternate-names link reference
1 parent 87a1100 commit bb02059

File tree

1 file changed

+145
-7
lines changed

1 file changed

+145
-7
lines changed

json-structure-primer.md

Lines changed: 145 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,21 @@ iterations. The industry has largely settled on "Draft 7" of JSON Schema, with
3434
subsequent releases seeing comparatively weak adoption. There's substantial
3535
frustration that many developers have with JSON Schema because they try to use
3636
it for scenarios that it was not designed for. JSON Schema is a powerful
37-
document validation tool, but it is not a data definition language.
37+
document validation tool, but it is not a data definition language. Frustration
38+
with JSON Schema is widespread across the industry—and yet it remains popular
39+
due to lack of good alternatives.
3840

39-
_JSON Structure_ aims to address these different use cases and priorities while
40-
maintaining familiarity with JSON Schema's syntax. While JSON Schema focuses on
41-
and excels at document validation, JSON Structure focuses on being a strong data
42-
definition language.
41+
Apache Avro is an alternative that has gained traction in the data community
42+
because it's much easier to create tooling on top of. However, Avro's type
43+
system is limited and its syntax is unfamiliar to most developers.
44+
45+
_JSON Structure_ aims to combine the tooling-friendliness of Avro with the
46+
familiar type definition shapes of JSON Schema while providing an overall
47+
broader type system and data documentation/qualification capabilities that
48+
provide richer context for AI/LLMs trying to understand data structures.
49+
50+
While JSON Schema focuses on and excels at document validation, JSON Structure
51+
focuses on being a strong data definition language.
4352

4453
There are two major use-case scenarios for schema languages in general:
4554

@@ -955,11 +964,140 @@ composition keywords.
955964
The [JSON Structure Validation][JSTRUCT-VALIDATION] companion specification
956965
introduces additional validation rules for JSON data.
957966

967+
## 8. SDK and Tooling Ecosystem
968+
969+
A schema language without tooling remains theoretical. For developers to adopt
970+
JSON Structure, they need to be able to tell whether schemas are valid, whether
971+
documents conform to a given schema, and they need to be able to turn schemas
972+
into data structures they can code against.
973+
974+
The JSON Structure SDKs provide native implementations for schema validation (is
975+
this schema well-formed?) and instance validation (does this JSON document
976+
conform to this schema?) across all major programming languages:
977+
978+
| Language | Package | Install |
979+
|----------|---------|--------|
980+
| Python | [json-structure](https://pypi.org/project/json-structure/) | `pip install json-structure` |
981+
| .NET/C# | [JsonStructure](https://www.nuget.org/packages/JsonStructure/) | `dotnet add package JsonStructure` |
982+
| Java | [json-structure](https://central.sonatype.com/artifact/io.json-structure/json-structure) | Maven Central |
983+
| TypeScript/JS | [@aspect/json-structure](https://www.npmjs.com/package/@aspect/json-structure) | `npm install @aspect/json-structure` |
984+
| Go | [github.com/json-structure/sdk/go](https://github.com/json-structure/sdk) | `go get github.com/json-structure/sdk/go` |
985+
| Rust | [json-structure](https://crates.io/crates/json-structure) | `cargo add json-structure` |
986+
| C/C++ (C99) | Build from repo | CMake |
987+
988+
For languages with runtime introspection (Java, .NET/C#, Python), the SDKs also
989+
include schema exporters that produce JSON Structure schemas from existing
990+
runtime data structures—useful for adopting JSON Structure incrementally in
991+
existing codebases.
992+
993+
The SDK repository is at <https://github.com/json-structure/sdk>
994+
995+
## 9. Visual Studio Code Extension
996+
997+
The JSON Structure extension for Visual Studio Code, built on the TypeScript
998+
SDK, provides a first-class editing experience for `.struct.json` schema files:
999+
1000+
- **Schema validation**: Real-time feedback on schema syntax and structure
1001+
- **Instance validation**: Validate JSON documents against JSON Structure schemas
1002+
- **IntelliSense**: Auto-completion for keywords, types, and references
1003+
- **Hover documentation**: Contextual help for all schema elements
1004+
1005+
Install from the VS Code Marketplace or search for "JSON Structure" in the
1006+
Extensions view.
1007+
1008+
## 10. Structurize: Schema Conversion and Code Generation
1009+
1010+
The **Structurize** tool (a persona of the Avrotize tool) enables robust,
1011+
predictable conversion between numerous schema formats and generates code for
1012+
multiple target languages. JSON Structure serves as a second "pivot" schema
1013+
model for this tool, meaning you can convert _from_ many formats _to_ JSON
1014+
Structure, and _from_ JSON Structure _to_ many targets—preserving the full
1015+
richness of the type model.
1016+
1017+
### Installation
1018+
1019+
```bash
1020+
pip install structurize
1021+
# or
1022+
pip install avrotize
1023+
```
1024+
1025+
For the moment, the tools have an identical set of commands, but they may
1026+
eventually be split. There will eventually be a bundled installer (as for the
1027+
Azure CLI) so that you don't need Python preinstalled.
1028+
1029+
### Example Conversions
1030+
1031+
| From | To | Command |
1032+
|------|-----|--------|
1033+
| JSON Structure | C# | `structurize jsonstruct2cs schema.struct.json --out Models.cs` |
1034+
| JSON Structure | Python | `structurize jsonstruct2py schema.struct.json --out models.py` |
1035+
| JSON Structure | Java | `structurize jsonstruct2java schema.struct.json --out-dir ./src` |
1036+
| JSON Structure | Go | `structurize jsonstruct2go schema.struct.json --out models.go` |
1037+
| JSON Structure | C++ | `structurize jsonstruct2cpp schema.struct.json --out models.hpp` |
1038+
| JSON Structure | Protobuf | `structurize jsonstruct2proto schema.struct.json --out schema.proto` |
1039+
| JSON Structure | PostgreSQL | `structurize jsonstruct2pgsql schema.struct.json --out schema.sql` |
1040+
1041+
There are many more database dialects and target formats available. The full
1042+
docs are in the [Avrotize repo README](https://github.com/clemensv/avrotize).
1043+
1044+
### Chaining Conversions
1045+
1046+
The tool is built such that you can pipe conversions, so you could go from ASN.1
1047+
via Avro to JSON Structure to C# with minimal loss of type info:
1048+
1049+
```bash
1050+
# ASN.1 → Avro → JSON Structure → C#
1051+
structurize asn2avro schema.asn | structurize avro2jsonstruct | structurize jsonstruct2cs --out Models.cs
1052+
```
1053+
1054+
## 11. Resources and Next Steps
1055+
1056+
### Specifications (IETF Internet Drafts)
1057+
1058+
All JSON Structure specifications are published as IETF Internet Drafts:
1059+
1060+
- [JSON Structure Core][JSTRUCT-CORE] - The core schema language
1061+
- [JSON Structure Import][JSTRUCT-IMPORT] - Importing types from other documents
1062+
- [JSON Structure Alternate Names][JSTRUCT-ALTNAMES] - Alternate names and i18n
1063+
- [JSON Structure Units][JSTRUCT-UNITS] - Symbols, scientific units, currencies
1064+
- [JSON Structure Validation][JSTRUCT-VALIDATION] - Validation constraints
1065+
- [JSON Structure Conditional Composition][JSTRUCT-COMPOSITION] - allOf, anyOf, oneOf, if/then/else
1066+
1067+
All drafts are available at:
1068+
<https://datatracker.ietf.org/doc/search?name=draft-vasters-json-structure>
1069+
1070+
### SDK and Tools
1071+
1072+
| Resource | Link |
1073+
|----------|------|
1074+
| SDK Repository | <https://github.com/json-structure/sdk> |
1075+
| VS Code Extension | Search "JSON Structure" in VS Code Marketplace |
1076+
| Structurize/Avrotize | `pip install structurize` or <https://github.com/clemensv/avrotize> |
1077+
1078+
### Sample Schemas
1079+
1080+
The [samples](./samples/) folder in this repository contains working examples
1081+
organized by specification:
1082+
1083+
- `samples/core/` - Core specification examples with validation scripts
1084+
- `samples/import/` - Import specification examples
1085+
1086+
### Getting Started
1087+
1088+
1. **Install the VS Code extension** for editing support with validation and
1089+
IntelliSense
1090+
2. **Install the SDK** for your language to validate schemas and instances
1091+
programmatically
1092+
3. **Try the samples** to understand the schema patterns
1093+
4. **Use Structurize** to convert existing schemas or generate code for your
1094+
target language
1095+
9581096
---
9591097

960-
[JSTRUCT-ALTNAMES]: https://github.com/json-structure/altername-names
1098+
[JSTRUCT-ALTNAMES]: https://github.com/json-structure/alternate-names
9611099
[JSTRUCT-COMPOSITION]: https://github.com/json-structure/conditional-composition
9621100
[JSTRUCT-IMPORT]: https://github.com/json-structure/import
963-
[JSTRUCT-UNITS]:https://github.com/json-structure/units
1101+
[JSTRUCT-UNITS]: https://github.com/json-structure/units
9641102
[JSTRUCT-VALIDATION]: https://github.com/json-structure/validation
9651103
[JSTRUCT-CORE]: https://github.com/json-structure/core

0 commit comments

Comments
 (0)