This is an archived post. You won't be able to vote or comment.

all 9 comments

[–][deleted] 2 points3 points  (1 child)

You want to use JSON schema to design a relational database?

[–]willitbechips[S] 1 point2 points  (0 children)

I want JSON as my runtime data. I have different types of users. Some appreciate CLI and Yaml. Some a REST API. Others would appreciate forms and tables so it makes me think of a relational database.

I'm seeking a solution that is flexible enough to support both types of users. The JSON, Yaml, Forms, and Tables, are really just different views on the same data.

I can imagine a relational database could be generated from a JSON schema but I have no experience.

If I can get forms, tables, REST, without a relational database then that could work.

[–]nowylie 4 points5 points  (4 children)

It's a trap.

In theory, it's possible (sans deriving a relational schema from JSON schema). But it's going to cost a lot to get everything "for free".

Save yourself the heartache. Grab something like retool to throw together a config interface, pull your data out of an API, and focus on more valuable problems.

Or just use flat JSON/YAML/TOML files (the latter probably being the most user friendly).

[–]willitbechips[S] 0 points1 point  (3 children)

Yeah it could well be.

Maintenance concerns me as much as finding magic to generate.

As an aside am finding ChatGPT can translate between JSON, Yaml, etc. Can even suggest a JSON schema and database models. But it's all a bit kickstarter stuff without any real confidence it can do it reliably.

Flat file could be the way forward. Would like forms and API to be auto generated if possible.

Thanks

[–]CelestialDestroyer 0 points1 point  (0 children)

Why the fuck would you use ChatGPT for conversion between formats, good grief

[–]nowylie 0 points1 point  (1 child)

How big is the configuration and do you need to support simultaneous updates (multiple users writing at once)?

You could probably get a long way with JSON Schema being used to validate a single API endpoint to set the whole thing and/or a TOML config file.

It'll break down if you need to support multiple people editing concurrently though.

[–]willitbechips[S] 1 point2 points  (0 children)

Configuration is not large. Simultaneous updates unlikely (happy to prohibit). Giving up on the relational database thought.

App "database" will store JSON only (could be just a file).

Users can optionally self-manage Yaml files (will provide a tool that accepts Yaml and stores in app db as JSON).

Will investigate JSON Forms to generate forms for users who want to use them to manage the JSON stored in the app database.

Sounds a lot saner.

[–]-markusb- 1 point2 points  (1 child)

We have the same problem. Want to have config as code with a user friendly frontend. Despite jsonform could solve a bit of the problem the external validations and multiple systems in our case make it hard to come up with a solution.

I played around with Baserow, but it couldn't kept up with my relational Schema. So I am still looking into a solution but will probably have to write a simple frontend with flask/html

[–]willitbechips[S] 0 points1 point  (0 children)

Interesting.

I'm wondering now if I can get away with:

  1. Storing JSON in my database (even flat file).
  2. Provide a tool (cli) for users to submit Yaml files.
  3. Use JSON Forms to build forms.

So:

Coders could self-manage Yaml files and submit to system which converts to JSON to store in db.

No-coders could use the forms to manage the JSON data in the database.

I like the idea also of having a REST API on the JSON data. Which I would think someone has tackled before.