Browse Source

Merge pull request #24893 from abpframework/salihozkara/low-code-schema

Add lowcode JSON schema definitions
pull/24900/head
Berkan Sasmaz 8 months ago
committed by GitHub
parent
commit
26e4a87b78
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 23
      lowcode/schema/definitions/command-interceptor-descriptor.schema.json
  2. 45
      lowcode/schema/definitions/endpoint-descriptor.schema.json
  3. 42
      lowcode/schema/definitions/entity-descriptor.schema.json
  4. 58
      lowcode/schema/definitions/entity-property-descriptor.schema.json
  5. 25
      lowcode/schema/definitions/entity-property-type.schema.json
  6. 32
      lowcode/schema/definitions/entity-property-ui-descriptor.schema.json
  7. 15
      lowcode/schema/definitions/entity-property-ui-form-availability.schema.json
  8. 14
      lowcode/schema/definitions/entity-ui-descriptor.schema.json
  9. 41
      lowcode/schema/definitions/enum-descriptor.schema.json
  10. 27
      lowcode/schema/definitions/foreign-key-descriptor.schema.json
  11. 15
      lowcode/schema/definitions/interceptor-type.schema.json
  12. 69
      lowcode/schema/definitions/validator-descriptor.schema.json
  13. 35
      lowcode/schema/model.schema.json

23
lowcode/schema/definitions/command-interceptor-descriptor.schema.json

@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "command-interceptor-descriptor.schema.json",
"title": "CommandInterceptorDescriptor",
"description": "Describes a command interceptor",
"type": "object",
"properties": {
"commandName": {
"type": "string",
"description": "Name of the command to intercept",
"enum": ["Create", "Update", "Delete"]
},
"type": {
"$ref": "interceptor-type.schema.json"
},
"javascript": {
"type": "string",
"description": "JavaScript code to execute"
}
},
"required": ["commandName", "type", "javascript"],
"additionalProperties": false
}

45
lowcode/schema/definitions/endpoint-descriptor.schema.json

@ -0,0 +1,45 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:abp:lowcode:endpoint-descriptor",
"title": "Custom Endpoint Descriptor",
"description": "Defines a custom HTTP endpoint that executes JavaScript code",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique identifier for the endpoint"
},
"route": {
"type": "string",
"description": "URL route pattern (e.g., '/api/custom/products/{id}')"
},
"method": {
"type": "string",
"description": "HTTP method",
"enum": ["GET", "POST", "PUT", "DELETE", "PATCH"],
"default": "GET"
},
"javascript": {
"type": "string",
"description": "JavaScript code to execute. Has access to context object with request, db, currentUser, emailSender."
},
"requireAuthentication": {
"type": "boolean",
"description": "Whether authentication is required",
"default": true
},
"requiredPermissions": {
"type": "array",
"description": "Permission names required to access the endpoint",
"items": {
"type": "string"
}
},
"description": {
"type": "string",
"description": "Optional description for documentation"
}
},
"required": ["name", "route", "javascript"],
"additionalProperties": false
}

42
lowcode/schema/definitions/entity-descriptor.schema.json

@ -0,0 +1,42 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-descriptor.schema.json",
"title": "EntityDescriptor",
"description": "Describes an entity configuration",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Full name of the entity (e.g., 'Namespace.EntityName')",
"minLength": 1
},
"displayProperty": {
"type": "string",
"description": "The property to be used as the display property for the entity"
},
"parent": {
"type": "string",
"description": "Full name of the parent entity (e.g., 'Namespace.EntityName')",
"minLength": 1
},
"ui": {
"$ref": "entity-ui-descriptor.schema.json"
},
"properties": {
"type": "array",
"description": "List of property descriptors",
"items": {
"$ref": "entity-property-descriptor.schema.json"
}
},
"interceptors": {
"type": "array",
"description": "List of command interceptors",
"items": {
"$ref": "command-interceptor-descriptor.schema.json"
}
}
},
"required": ["name"],
"additionalProperties": false
}

58
lowcode/schema/definitions/entity-property-descriptor.schema.json

@ -0,0 +1,58 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-property-descriptor.schema.json",
"title": "EntityPropertyDescriptor",
"description": "Describes a property configuration",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the property",
"minLength": 1
},
"type": {
"$ref": "entity-property-type.schema.json"
},
"enumType": {
"type": "string",
"description": "Name of a JSON-defined enum (or full type name for code enums)"
},
"allowSetByClients": {
"type": "boolean",
"description": "Indicates whether clients are allowed to set this property"
},
"serverOnly": {
"type": "boolean",
"description": "When true, this property is completely hidden from clients (API responses and UI definitions). Use for sensitive data like passwords."
},
"isMappedToDbField": {
"type": "boolean",
"description": "Indicates whether the property is mapped to a database field"
},
"isUnique": {
"type": "boolean",
"description": "Indicates whether the property value must be unique across all entities"
},
"isRequired": {
"type": "boolean",
"description": "When true, the property is required (not nullable). Affects DB column (NOT NULL), UI validation, and backend validation."
},
"ui": {
"$ref": "entity-property-ui-descriptor.schema.json"
},
"foreignKey": {
"$ref": "foreign-key-descriptor.schema.json"
},
"validators": {
"type": "array",
"description": "Array of validators to apply to this property",
"items": {
"$ref": "validator-descriptor.schema.json"
}
}
},
"required": [
"name"
],
"additionalProperties": false
}

25
lowcode/schema/definitions/entity-property-type.schema.json

@ -0,0 +1,25 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-property-type.schema.json",
"title": "EntityPropertyType",
"description": "Data type of the property",
"type": "string",
"enum": [
"string",
"String",
"int",
"Int",
"long",
"Long",
"decimal",
"Decimal",
"dateTime",
"DateTime",
"boolean",
"Boolean",
"guid",
"Guid",
"enum",
"Enum"
]
}

32
lowcode/schema/definitions/entity-property-ui-descriptor.schema.json

@ -0,0 +1,32 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-property-ui-descriptor.schema.json",
"title": "EntityPropertyUIDescriptor",
"description": "UI configuration for a property",
"type": "object",
"properties": {
"displayName": {
"type": "string",
"description": "Display name for the property in UI. Falls back to property name if not set."
},
"isAvailableOnDataTable": {
"type": "boolean",
"description": "Whether the property is shown in the data table listing"
},
"isAvailableOnDataTableFiltering": {
"type": "boolean",
"description": "Whether the property is available for filtering in the data table"
},
"creationFormAvailability": {
"$ref": "entity-property-ui-form-availability.schema.json"
},
"editingFormAvailability": {
"$ref": "entity-property-ui-form-availability.schema.json"
},
"quickLookOrder": {
"type": "integer",
"description": "Order of the property in quick look views. Higher numbers appear first. Set to -1 to exclude from quick look. If no property has a value, first 5 properties by name are shown."
}
},
"additionalProperties": false
}

15
lowcode/schema/definitions/entity-property-ui-form-availability.schema.json

@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-property-ui-form-availability.schema.json",
"title": "EntityPropertyUIFormAvailability",
"description": "Availability of the property on forms",
"type": "string",
"enum": [
"Available",
"available",
"Hidden",
"hidden",
"NotAvailable",
"notAvailable"
]
}

14
lowcode/schema/definitions/entity-ui-descriptor.schema.json

@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "entity-ui-descriptor.schema.json",
"title": "EntityUIDescriptor",
"description": "UI configuration for the entity",
"type": "object",
"properties": {
"pageTitle": {
"type": "string",
"description": "Title to display on the entity's page"
}
},
"additionalProperties": false
}

41
lowcode/schema/definitions/enum-descriptor.schema.json

@ -0,0 +1,41 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "enum-descriptor.schema.json",
"title": "EnumDescriptor",
"description": "Describes an enum definition for use in entity properties",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Unique name for the enum",
"minLength": 1
},
"values": {
"type": "array",
"description": "List of enum values",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Display name of the enum value"
},
"value": {
"type": "integer",
"description": "Integer value (auto-assigned if omitted)"
}
},
"required": [
"name"
],
"additionalProperties": false
},
"minItems": 1
}
},
"required": [
"name",
"values"
],
"additionalProperties": false
}

27
lowcode/schema/definitions/foreign-key-descriptor.schema.json

@ -0,0 +1,27 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "foreign-key-descriptor.schema.json",
"title": "ForeignKeyDescriptor",
"description": "Describes a foreign key relationship",
"type": "object",
"properties": {
"entityName": {
"type": "string",
"description": "Full name of the related entity",
"minLength": 1
},
"displayPropertyName": {
"type": "string",
"description": "Property name to display from the related entity",
"minLength": 1
},
"access": {
"type": "string",
"description": "Access level for managing this relation from the referenced entity side. When set to 'view' or 'edit', the referenced entity can see/manage items that reference it.",
"enum": ["none", "view", "edit"],
"default": "none"
}
},
"required": ["entityName"],
"additionalProperties": false
}

15
lowcode/schema/definitions/interceptor-type.schema.json

@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "interceptor-type.schema.json",
"title": "InterceptorType",
"description": "When the interceptor runs",
"type": "string",
"enum": [
"Pre",
"pre",
"Post",
"post",
"Replace",
"replace"
]
}

69
lowcode/schema/definitions/validator-descriptor.schema.json

@ -0,0 +1,69 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "validator-descriptor.schema.json",
"title": "ValidatorDescriptor",
"description": "A single validator in the validators array",
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"description": "Type of validator",
"enum": [
"required",
"minLength",
"maxLength",
"stringLength",
"min",
"minimum",
"max",
"maximum",
"range",
"pattern",
"regularExpression",
"email",
"emailAddress",
"phone",
"url",
"creditCard"
]
},
"message": {
"type": "string",
"description": "Custom error message for this validator"
},
"length": {
"type": "integer",
"description": "Length value for minLength, maxLength validators",
"minimum": 0
},
"minimumLength": {
"type": "integer",
"description": "Minimum length for stringLength validator",
"minimum": 0
},
"maximumLength": {
"type": "integer",
"description": "Maximum length for stringLength validator",
"minimum": 0
},
"value": {
"type": "number",
"description": "Value for min/minimum, max/maximum validators"
},
"minimum": {
"type": "number",
"description": "Minimum value for range validator"
},
"maximum": {
"type": "number",
"description": "Maximum value for range validator"
},
"pattern": {
"type": "string",
"description": "Regular expression pattern for pattern/regularExpression validators"
}
},
"additionalProperties": true
}

35
lowcode/schema/model.schema.json

@ -0,0 +1,35 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "model.schema.json",
"title": "ABP Low Code Model",
"description": "Schema for ABP Low Code model.json configuration file",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "Reference to the JSON schema"
},
"enums": {
"type": "array",
"description": "List of enum definitions",
"items": {
"$ref": "definitions/enum-descriptor.schema.json"
}
},
"entities": {
"type": "array",
"description": "List of entity descriptors",
"items": {
"$ref": "definitions/entity-descriptor.schema.json"
}
},
"endpoints": {
"type": "array",
"description": "List of custom HTTP endpoints that execute JavaScript code",
"items": {
"$ref": "definitions/endpoint-descriptor.schema.json"
}
}
},
"additionalProperties": false
}
Loading…
Cancel
Save