editorui

package
v0.1.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package editorui embeds the visual schema editor (Appximo Studio, UI-F0-S1) and serves it from the engine binary under /editor. The compiled SPA lives in web/build and is COMMITTED (ADR-025): the published module carries the prebuilt assets, so any `go build` — including a module consumer's — ships a working Studio. After touching web/src, rebuild with `make editor-ui` and commit the new assets with the src change. A binary that embeds no assets serves an honest 503 from the shell routes instead of a blank page (B1).

The editor is a STATIC single-page Svelte 5 app (plain Vite, no SvelteKit) — there is NO Node process in production: the browser downloads HTML/JS/CSS and runs the editor entirely client-side. The engine only hands out the files.

Real server paths:

  • GET /editor and /editor/ → index.html (no-cache; always points at the current hashed assets)
  • GET /editor/assets/<hash> → immutable (cached forever by the browser)
  • GET /editor/<other> → the matching build file (e.g. favicon.svg)

These are NEW static routes, off the CRUD/JWT hot path (JWT-skipped via the "/editor" prefix in pkg/auth.skipJWT; tenant-agnostic like /admin).

JSON-EDITOR-S1: the validation surface for Studio's assisted JSON editor. Two THIN, STATELESS routes in the /openapi class — no DB access, no deploy, no hot-path involvement, JWT-skipped like the rest of /editor:

  • POST /editor/validate — body = a raw candidate schema JSON (1 MiB cap, same as the engine's body cap); response = schema.ValidateReport, the AI-F0-S2 unified structural+semantic report (dot-path / rule / expected / got / fix per error). This is the editor's SEMANTIC layer: the frontend never reimplements the validator, it renders this report at the right lines. Debounce-friendly: pure function of the body, callable per keystroke.

  • GET /editor/meta-schema — the embedded formal JSON Schema meta-schema (Draft 2020-12, pkg/schema/appximo.schema.json), for the editor's client-side STRUCTURAL layer (CodeMirror autocompletion/hover/diagnostics). Same bytes as `appximo meta-schema`; cacheable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasBuiltAssets

func HasBuiltAssets() bool

HasBuiltAssets reports whether real (hashed) assets are embedded — false means only the placeholder index.html is present (the bundle was not built before `go build`). Used by the engine to log a helpful warning.

func Register

func Register(r chi.Router) error

Register mounts the editor routes on r. The shell is public (JWT-skipped via the "/editor" prefix); the SPA runs client-side and talks to the engine only when a future "deploy" action is wired.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL