-
Notifications
You must be signed in to change notification settings - Fork 29
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
Where are you using it? #89
Comments
Collaborative Schema-Driven Data EditorAutomatic UI generation and backend routing, the client and backend decide automatically what and how everything must be processed and shown. An visual example and technical overview with small code examples: ui-schema-data-editor.mp4Dev Focus
Technical DescriptionBackend and model<>schema definition basics:
Client side:
Examples
Example JSON-SchemaThis is the schema for an It contains a special The {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"customer": {
"type": "string",
"widget": "EntitySelect",
"entity": "customer",
"read": {
"/details/name": {
"view": {
"sizeMd": 5
}
},
"/details/company": {
"view": {
"sizeMd": 3
}
},
"/details/email": {
"view": {
"sizeMd": 4
}
},
"/details/phone": {
"hidden": true
},
"/details/billingAddress": {
"hidden": true
},
"/details/postalAddress": {
"hidden": true
}
}
}
},
"required": [
"id"
]
} Example Backend SpecExample backend spec for an export type Spec = {} // private code
export const schemaCollection = () => {} // private code
export const schemaDetails = () => {} // private code
export const schemaResult = () => {} // private code
export const specProject: Spec<'project'> = {
name: 'project',
grants: [
{
perm: 'read',
public: true,
},
{
perm: 'write',
roles: ['member'],
},
/*{
perm: 'delete',
roles: ['admin'],
},*/
],
ops: [
{
type: 'details',
// special `$entity` placeholder replaced with the entity `name`
out: schemaDetails('entity/$entity'),
perms: ['read', 'details'],
// special `$key` placeholder, replaced with the `key` prop when existing
params: ['$key'],
use: ['firestore', 'api'],
// `method` defaults to `get` when `in` is missing
},
{
type: 'collect',
out: schemaCollection('entity/$entity'),
use: ['firestore', 'api'],
perms: ['read', 'collect'],
},
{
type: 'create',
in: 'entity/$entity',
out: 'entity/$entity',
perms: ['write', 'create'],
method: 'put',
use: ['api'],
},
{
type: 'update',
in: 'entity/$entity_update',
out: schemaResult({type: 'boolean'}),
perms: ['write', 'update'],
params: ['$key'],
// `method` defaults to `post` when `in` is existing
},
{
type: 'delete',
out: schemaResult({type: 'boolean'}),
perms: ['write', 'delete'],
params: ['$key'],
method: 'delete',
},
],
// used for the `List` labels / can be overwritten from within schema
listLabelKeys: ['name'],
// the unique `id` of an entity / compound-keys are possible but not shown here
key: 'id',
// e.g. `auto` for auto-increment/auto-created ids
keyGen: 'input',
// which DB-binding the backend implementation must use, e.g. can be an custom repository per entity for e.g. PostgreSQL
binding: 'firestore',
}
export interface IProject {
id: string
name?: string
customer?: string
} Example Public SpecThis public spec is generated automatically by one endpoint, exposing only the public execution info and only the operations the user is allowed to execute. With this schema the UI can automatically run any further operations necessary to provide the full editor experience. {
"ops": {
"details": {
"params": [
"id"
],
"out": {
"type": "object",
"properties": {
"details": {
"$ref": "http://localhost:3030/schemas/entity/project",
"type": "object"
}
}
},
"href": "http://localhost:3030/e/project/details/{id}",
"templated": true,
"method": "get",
"use": [
"firestore",
"api"
]
},
"collect": {
"params": [],
"out": {
"type": "object",
"properties": {
"collection": {
"type": "array",
"items": {
"$ref": "http://localhost:3030/schemas/entity/project",
"type": "object"
}
}
}
},
"href": "http://localhost:3030/e/project/collect",
"method": "get",
"use": [
"firestore",
"api"
]
},
"create": {
"params": [],
"in": {
"$ref": "http://localhost:3030/schemas/entity/project",
"type": "object"
},
"out": {
"$ref": "http://localhost:3030/schemas/entity/project",
"type": "object"
},
"href": "http://localhost:3030/e/project/create",
"method": "put",
"use": [
"api"
]
},
"update": {
"params": [
"id"
],
"in": {
"$ref": "http://localhost:3030/schemas/entity/project_update",
"type": "object"
},
"out": {
"type": "object",
"properties": {
"result": {
"type": "boolean"
}
}
},
"href": "http://localhost:3030/e/project/update/{id}",
"templated": true,
"method": "post"
},
"delete": {
"params": [
"id"
],
"out": {
"type": "object",
"properties": {
"result": {
"type": "boolean"
}
}
},
"href": "http://localhost:3030/e/project/delete/{id}",
"templated": true,
"method": "delete"
}
},
"model": {
"name": "project",
"key": "id",
"keyGen": "input",
"listLabelKeys": [
"name"
]
}
} Example Open-Api DocsGenerated Open-Api docs, using the backend schema, this shows the Side Notes
|
Help me to better shape the future of UI-Schema!
Show what you've built - or explain what you would like to built with it.
Just respond here with:
From my side UI-Schema is currently developed for use as the central part of a schema driven headless information management and content management system, some features like
UIStorePro
are made open-source after the initial development there. Can't show some screenshots atm.The text was updated successfully, but these errors were encountered: