Skip to content

[Feature Request] JSON Schema output #84

@jordens

Description

@jordens

🚀 Feature Request

Add a JSON Schema backend for serde-generate.

Motivation

JSON Schema as a representation for the schema generated by serde-reflection would be nice.

In a first step I'd try this as a simple backend to serde-generate.

Later one could also consider using JSON Schema for the serde-generate input and replacing the ad-hoc YAML. That would decouple serde-reflection (build schema) from serde-generate (implement schema).

Pitch

I'm happy to spin a PR if this receives support. It would amount to extracting the code we already have and moving it into a new serde-generate backend:

https://github.com/quartiq/miniconf/blob/c741c31b8fcd5e8769861c16081f0d6895e019a2/miniconf/src/json_schema.rs#L58-L188

Additional context

We use this to build JSON schemata for a heterogeneous trees of serde leaves:
https://github.com/quartiq/miniconf/blob/c741c31b8fcd5e8769861c16081f0d6895e019a2/miniconf/examples/trace.rs

The end use case is typically embedded application settings that we modify with JSON over MQTT or JSON over serial/usb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions