Background

Following up on the comment in the FlowDrop issue queue https://www.drupal.org/project/flowdrop/issues/3538963#comment-16589655 to see how we can find synergies between modules.

It would be great if we can get schema "on-demand" that FlowDrop can use.

FlowDrop uses "JSON Schema" as a language in which contracts are defined within the system. This can then be used by Tasks/Processors which may nor may not be AI based.

Task

- Figure out how what is available for FlowDrop to use from ai_schema
- Figure out if something needs to be done in ai_schema and in FlowDrop to create the bridge

Comments

d34dman created an issue. See original summary.

erdemalkan’s picture

Hello,

That’s great news.

We were on a nine-day national holiday break. I think I’ll be able to provide an update sometime this week. Sorry for the delayed response.

erdemalkan’s picture

Branch: 3590883-json-schema-api

What was done

Added JSON Schema support and a REST API submodule to make ai_schema data available on-demand.

1. JsonSchemaBuilder service (core module)
- buildBundleSchema($entityType, $bundle) — returns JSON Schema for a single entity bundle, on-demand
- build() — returns JSON Schema for all fieldable entity bundles
- Uses only the FlowDrop-compatible subset: no $ref, oneOf, anyOf, allOf
- New Drush command: drush aischema:jsonschema

2. ai_schema_api submodule (modules/ai_schema_api/)
- REST endpoints behind access ai schema api permission
- Key endpoint for FlowDrop: GET /api/ai-schema/json-schema/{entity_type}/{bundle}
- Also exposes: entity-export, compact, relations, storage, sql

3. Computed field support (all builders)
- Computed fields are now marked so LLMs/processors don't try to set them
- EntityExport: "computed": true
- CompactModel: ~ modifier (e.g. str~)
- JsonSchema: "readOnly": true + description note

How FlowDrop can consume this
Same Drupal instance (PHP):
$schema = \Drupal::service('ai_schema.json_schema')->buildBundleSchema('node', 'article');

Over HTTP:
GET /api/ai-schema/json-schema/node/article

erdemalkan’s picture

Status: Active » Needs review
erdemalkan’s picture