All Projects → atombender → Go Jsonschema

atombender / Go Jsonschema

Licence: mit
A tool to generate Go data types from JSON Schema definitions.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Jsonschema

Uvicorn Gunicorn Fastapi Docker
Docker image with Uvicorn managed by Gunicorn for high-performance FastAPI web applications in Python 3.6 and above with performance auto-tuning. Optionally with Alpine Linux.
Stars: ✭ 1,014 (+518.29%)
Mutual labels:  json-schema, json
Schemasafe
A reasonably safe JSON Schema validator with draft-04/06/07/2019-09 support.
Stars: ✭ 67 (-59.15%)
Mutual labels:  json-schema, json
Oakdex Pokedex
Ruby Gem and Node Package for comprehensive Generation 1-7 Pokedex data, including 809 Pokémon, uses JSON schemas to verify the data
Stars: ✭ 44 (-73.17%)
Mutual labels:  json-schema, json
Spectral
A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.
Stars: ✭ 876 (+434.15%)
Mutual labels:  json-schema, json
Schema Registry
Confluent Schema Registry for Kafka
Stars: ✭ 1,647 (+904.27%)
Mutual labels:  json-schema, json
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+24039.02%)
Mutual labels:  json-schema, json
Jsonschema Key Compression
Compress json-data based on its json-schema while still having valid json
Stars: ✭ 59 (-64.02%)
Mutual labels:  json-schema, json
Jsonschema2pojo
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
Stars: ✭ 5,633 (+3334.76%)
Mutual labels:  json-schema, json
React Jsonschema Form
A React component for building Web forms from JSON Schema.
Stars: ✭ 10,870 (+6528.05%)
Mutual labels:  json-schema, json
Json Node Normalizer
'json-node-normalizer' - NodeJS module that normalize json data types from json schema specifications.
Stars: ✭ 105 (-35.98%)
Mutual labels:  json-schema, json
Movement
Movement is an easier, simpler way to explore and use NIEM. Want to join the Movement and contribute to it? Start here.
Stars: ✭ 19 (-88.41%)
Mutual labels:  json-schema, json
Typedload
Python library to load dynamically typed data into statically typed data structures
Stars: ✭ 120 (-26.83%)
Mutual labels:  json-schema, json
Quicktype
Generate types and converters from JSON, Schema, and GraphQL
Stars: ✭ 7,459 (+4448.17%)
Mutual labels:  json-schema, json
Brutusin Rpc
Self-describing JSON-RPC web services over HTTP, with automatic API description based on JSON-Schema
Stars: ✭ 36 (-78.05%)
Mutual labels:  json-schema, json
Conf
Simple config handling for your app or module
Stars: ✭ 707 (+331.1%)
Mutual labels:  json-schema, json
Univalue
High performance RAII C++ JSON library and universal value object class
Stars: ✭ 46 (-71.95%)
Mutual labels:  json-schema, json
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+4555.49%)
Mutual labels:  json-schema, json
Jsesc
Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
Stars: ✭ 600 (+265.85%)
Mutual labels:  json, code-generation
Avocado
Strongly-typed MongoDB driver for Rust
Stars: ✭ 70 (-57.32%)
Mutual labels:  json-schema, json
Npoint
JSON storage bins with schema validation
Stars: ✭ 116 (-29.27%)
Mutual labels:  json-schema, json

go-jsonschema is a tool to generate Go data types from JSON Schema definitions.

This tool generates Go data types and structs that corresponds to definitions in the schema, along with unmarshaling code that validates the input JSON according to the schema's validation rules.

Installing

  • Binary install: Get a release here.

  • From source: Go 1.11 or later, with Go modules enabled, is advisable in order to get the right dependencies. To install:

$ go get github.com/atombender/go-jsonschema/...
$ go install github.com/atombender/go-jsonschema/cmd/gojsonschema

Usage

At its most basic:

$ gojsonschema -p main schema.json

This will write a Go source file to standard output, declared under the package main.

You can generate code for multiple schemas in the same invocation, optionally writing to different files inside different packages:

$ gojsonschema \
  --schema-package=https://example.com/schema1=github.com/myuser/myproject \
   --schema-output=https://example.com/schema1=schema1.go \
  --schema-package=https://example.com/schema2=github.com/myuser/myproject/stuff \
   --schema-output=https://example.com/schema2=stuff/schema2.go \
  schema1.json schema2.json

This will create schema1.go (declared as package myproject) and stuff/schema2.go (declared as package stuff). If schema1.json refers to schema2.json or vice versa, the two Go files will import the other package that it depends on. Note the flag format:

--schema-package=https://example.com/schema1=github.com/myuser/myproject \
                 ^                           ^
                 |                           |
                 schema $id                  full import URL

Status

While not finished, go-jsonschema can be used today. Aside from some minor features, only specific validations remain to be fully implemented.

Validation

  • Core (RFC draft)
    • [x] Data model (§4.2.1)
      • [x] null
      • [x] boolean
      • [x] object
      • [x] array
      • [x] number
        • [ ] Option to use json.Number
      • [x] string
    • [ ] Location identifiers (§8.2.3)
      • [x] References against top-level names: #/Definitions/someName
      • [ ] References against nested names: #/Definitions/someName/Definitions/someOtherName
      • [x] References against top-level names in external files: myschema.json#/Definitions/someName
      • [ ] References against nested names: myschema.json#/Definitions/someName/Definitions/someOtherName
    • [x] Comments (§9)
  • Validation (RFC draft)
    • [ ] Schema annotations (§10)
      • [x] description
      • [x] default (only for struct fields)
      • [ ] readOnly
      • [ ] writeOnly
      • [ ] title (N/A)
      • [ ] examples (N/A)
    • [ ] General validation (§6.1)
      • [x] enum
      • [x] type (single)
      • [x] type (multiple; note: partial support, limited validation)
      • [ ] const
    • [ ] Numeric validation (§6.2)
      • [ ] multipleOf
      • [ ] maximum
      • [ ] exclusiveMaximum
      • [ ] minimum
      • [ ] exclusiveMinimum
    • [ ] String validation (§6.3)
      • [ ] maxLength
      • [ ] minLength
      • [ ] pattern
    • [ ] Array validation (§6.4)
      • [X] items
      • [ ] maxItems
      • [ ] minItems
      • [ ] uniqueItems
      • [ ] additionalItems
      • [ ] contains
    • [ ] Object validation (§6.5)
      • [x] required
      • [x] properties
      • [ ] patternProperties
      • [ ] dependencies
      • [ ] propertyNames
      • [ ] maxProperties
      • [ ] minProperties
    • [ ] Conditional subschemas (§6.6)
      • [ ] if
      • [ ] then
      • [ ] else
    • [ ] Boolean subschemas (§6.7)
      • [ ] allOf
      • [ ] anyOf
      • [ ] oneOf
      • [ ] not
    • [ ] Semantic formats (§7.3)
      • [ ] Dates and times
      • [ ] Email addresses
      • [ ] Hostnames
      • [ ] IP addresses
      • [ ] Resource identifiers
      • [ ] URI-template
      • [ ] JSON pointers
      • [ ] Regex

License

MIT license. See LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].