Expand Lua DSL#1
Conversation
Resolve public callable paths through Manifest entrypoint metadata, with explicit domain namespaces and eval/docs/runtime consuming the annotated manifest.
Map configured field_names and argument_names across inputs, fields, filters, sorts, operations, outputs, docs, and Ash error fields.
Cover explicit public paths, Manifest entrypoint metadata, eval/docs scoping, aliases, and verifier failures with focused fixtures.
|
|
||
| alias Spark.Dsl.Verifier | ||
|
|
||
| @reserved_input_keys ~w(fields filter sort limit offset page operation) |
There was a problem hiding this comment.
@olivermt this points out an issue: we should put all the input arguments into an input named argument, not combine them all up at the top 😓
There was a problem hiding this comment.
that means breaking backwards compability on whats already there does it not? Maybe thats fine on a 0.2.x ?
There was a problem hiding this comment.
I have found a possible path forward:
- namespaces nest under
input - old auto-derived stuff stays as-is
Means we need two parse paths, but it means we can mark it deprecated, although how that will work when exposing an integrated runtime internally I don't know. I guess it mostly applies to people exposing user codable sandboxes and stuff (which I do, but no customers is using it yet, so I don't care).
There was a problem hiding this comment.
Something like this maybe? olivermt@b0f4a10
There was a problem hiding this comment.
I don't think we need to maintain backwards compatibility. This package came out like 2 weeks ago and is pre 1.0
|
@olivermt mind checking the failing checks? |
|
Checks are fixed |
|
🚀 Thank you for your contribution! 🚀 |
Summary
This PR adds explicit Lua surface DSL for AshLua, plus Lua-facing field and argument aliases.
The PR is split into three reviewable commits, each green on its own.
Commit 1:
Add domain-owned Lua surface DSLThis commit introduces domain-owned Lua namespaces and public action aliases.
Example:
This exposes:
while dispatch still calls the internal Ash action:
Main Ideas
Domains own the public Lua namespace.
Resources still own the Ash implementation.
The Manifest remains the source of truth.
AshLua.Surfacenow generates/annotates%Ash.Info.Manifest{}entrypoints with:containing public path metadata such as:
Runtime and docs no longer independently reconstruct callable paths. They read the public path from the annotated manifest entrypoint.
Backwards Compatibility
This is opt-in per domain.
Domains without explicit
lua namespace ... action ...config keep the old inferred callable shape:So existing calls like this continue to work:
Once a domain declares explicit namespaces, that domain exposes only the configured public actions. This avoids accidentally creating two public APIs for the same domain.
Other domains in the same OTP app remain on the legacy inferred shape until they opt in.
Commit 2:
Add Lua field and argument aliasesThis commit adds Lua-facing names for resource fields and action arguments.
Example:
This lets Lua use:
while Ash still receives internal names:
Main Ideas
AshLua.FieldNamesowns exact name mapping at the Lua boundary.Aliases are applied in both directions:
Lua -> Ash:
fieldsfiltersortoperationAsh -> Lua:
fieldsI have not attempted to solve a general manifest-level “filter object schema/traversal” system, that is something you intend to solve in Manifest itself it seems?
Commit 3:
Add surface fixture coverageThis commit adds a focused fixture domain/resource and tests that exercise the whole surface.
The fixture exposes:
The returned record type remains documented as:
So docs now show a coherent shape like: