Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building forms with RDFS or ShEx #259

Open
linonetwo opened this issue Apr 26, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@linonetwo
Copy link

commented Apr 26, 2019

Motivation

Create a form by writing JSON Schema: https://github.com/mozilla-services/react-jsonschema-form

So how about creating a form by writing RDFS or ShEx?

Proposal

const EmployeeForm = form.shex`
# example from http://shex.io/, this is isomorphic to a json-schema
# our EmployeeShape reuses the FOAF ontology
<EmployeeShape> {                # An <EmployeeShape> has:
    foaf:givenName  xsd:string+,   # at least one givenName.
    foaf:familyName xsd:string,    # one familyName.
    foaf:phone      IRI*,          # any number of phone numbers.
    foaf:mbox       IRI            # one FOAF mbox.
}
`;

export default () => <EmployeeForm />

Additional info

Currently, form frameworks like https://github.com/final-form/final-form, https://github.com/mozilla-services/react-jsonschema-form, and https://github.com/alibaba/uform are trying to extract logic (dependencies between fields and validation) out of View, and making data binding automatically (no need to write onChange).

So I thought, hooks in this repo already make data binding automatically by requiring exact data type from backend, why not, in the same way, describe logic using universal typing, generating two-way data binding automatically.

Make creating a form as easy as writing styled-components.

@RubenVerborgh

This comment has been minimized.

Copy link
Member

commented Apr 26, 2019

So how about creating a form by writing RDFS or ShEx?

We are very actively investigating this in the context of Solid.
Will transfer this issue there.

@RubenVerborgh RubenVerborgh transferred this issue from solid/react-components Apr 26, 2019

@RubenVerborgh RubenVerborgh changed the title Form builder Building forms with RDFS or ShEx Apr 26, 2019

@ericprud

This comment has been minimized.

Copy link

commented May 1, 2019

@linonetwo , I did a shex-form experiment and could generate validating forms from either a schema (form only) or the results of a validation (populated form). The folks at Janeiro are building a production form of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.