JSON Schema is a specification for defining the structure of JSON data. We use JSON Schema because it is a useful tool for describing the required content for the Data Passport (and other elements of the OETP, Transparency Protocol will be using the JSON Schema too).
JSON Schema could also be used for generating web forms where the users will input the exact data for their Data Passport, Open Ethics Label etc, because the schema allows us to define the structure and constraints (which fields are required, what are the format limitations etc) of a form in a language-agnostic way.
Here are some reasons why we should use JSON Schema instead of manual way of managing fields and how it can be useful for generating forms:
Why use JSON Schema?
Language-agnostic: JSON Schema is language-agnostic, which means you can use it to define the structure of your data regardless of the programming language you're using.
Data validation: JSON Schema allows you to define the constraints of your data, such as required fields, data types, and format, which ensures that the data is valid and consistent.
Reusable: JSON Schema can be reused across different applications and platforms, making it a great tool for defining a standard structure for your data.
Machine-readable: JSON Schema is machine-readable, which means you can use it to generate forms, validate data, and perform other automated tasks.
Why is JSON Schema useful for generating forms?
Automatic form generation: JSON Schema can be used to generate forms automatically, which saves time and reduces the risk of errors.
Form validation: JSON Schema can be used to validate form data, ensuring that the user-input data conforms to the defined structure and constraints.
Dynamic forms: JSON Schema can be used to generate dynamic forms that adapt to the user's input, such as conditional fields or dependent dropdowns.
Reusability: JSON Schema can be reused across different forms, applications, and platforms, making it a great tool for defining a standard structure for your forms.
The task
The task is to identify, adapt if necessary, test, and deploy the library out of the existing libraries for the form generation from JSON Schema.
Deliverable
As a result, the HTML/CSS/JavaScript code should be created that will take the JSON Schema URL from the Open Ethics website () and generate a form from it on the fly. It's preferable to use the plain JavaScript and not use libraries/frameworks like React or Angular.
The impact
The idea is that the changes to the Data Passport or other Schemas could be deployed only in one place but will immediately allow users to fill in the form and generate the Data Passport.json
Help other people with the same need to work with schema (the code will be opensourced)
Streamline working with forms, allowing also to generate OEDP, or OEL from the most recent updates in the Schema (for example right now we are not using the schema for the Open Ethics Label but we could https://openethics.ai/label/generate/)
Open Ethics Contributors work on the required components of the JSON Schema, it gets committed and merged to the main branch of OEDP repo (this is set up and the draft schema is in place)
Then Schema gets deployed automatically to Open Ethics website from the GitHub actions (already developed)
The forms are updated automatically without any need for human intervention or development, thanks to the script deployed via this task
The product owners always are exposed to the updated Data Passport forms and can generate valid Data Passport.json files as a result (future outcome)
JSON Schema is a specification for defining the structure of JSON data. We use JSON Schema because it is a useful tool for describing the required content for the Data Passport (and other elements of the OETP, Transparency Protocol will be using the JSON Schema too).
JSON Schema could also be used for generating web forms where the users will input the exact data for their Data Passport, Open Ethics Label etc, because the schema allows us to define the structure and constraints (which fields are required, what are the format limitations etc) of a form in a language-agnostic way.
Here are some reasons why we should use JSON Schema instead of manual way of managing fields and how it can be useful for generating forms:
Why use JSON Schema?
Why is JSON Schema useful for generating forms?
The task
The task is to identify, adapt if necessary, test, and deploy the library out of the existing libraries for the form generation from JSON Schema.
Deliverable
As a result, the HTML/CSS/JavaScript code should be created that will take the JSON Schema URL from the Open Ethics website () and generate a form from it on the fly. It's preferable to use the plain JavaScript and not use libraries/frameworks like React or Angular.
The impact
The idea is that the changes to the Data Passport or other Schemas could be deployed only in one place but will immediately allow users to fill in the form and generate the Data Passport.json
Some references
https://rjsf-team.github.io/react-jsonschema-form/ https://jsonforms.io/ https://stackoverflow.com/questions/20241059/how-to-create-a-form-from-a-json-schema