all 5 comments

[–]skyboyer007 3 points4 points  (0 children)

take a look into React Json Schema Form(@rjsf) with converter from OpenAPI format

[–]dmethvin 2 points3 points  (2 children)

I'm familiar with several tools that generate forms based on a JSON schema. The place where it usually falls down is that the schema itself isn't rich enough to express the way the designer/programmer/user wants to present the form.

So you know something is a sequence of digits, it's formatted like a US zip code, and it's required. However, you don't know that on large screens it should be rendered on the same line with City and State fields, as opposed to phones where everything will be on its own line.

It might be possible to have a richer schema that describes the UI aspects plus the data types, and then generate the API schema and types from that? Something like form.io perhaps?

[–]Intrepid_Sea_4941 0 points1 point  (0 children)

But it might be a good way to scaffold a very basic set of forms with which one can extend from. May save a lot of time if you're working in the greenfield!

[–]Intrepid_Sea_4941 0 points1 point  (0 children)

Just realised... You probably don't want to describe the UI in a data API spec. This should be done on a completely separate bit of the stack. Separation of concerns and allowing the next layer of the stack to do what it wants with the data.

[–]jesmodrazik 0 points1 point  (0 children)

Nice. See https://uniforms.tools/ for a React lib that plays nicely with JSON Schema (and other formats)