Describe module settings for studio as LoadedPack.schema()

PackSchema (com.volmit.host.schema) is a JSON-free description of every catalogued
settings type: features with their module, JSON field and targets, every reachable
class once by name (cycles end at the name), options with value kind, description,
required, bounds, defaults read from a no-argument instance and @Ref references,
plus object generator settings and snippets. Everything is in a fixed order.

The pack load fails, naming class, field and module, on unsupported field types,
@Ref on fields that are not text, classes without a working no-argument constructor
and snippet names that are not folder names or are used twice. GrassSettings.block
becomes a BlockState, a block reference without @Ref.
This commit is contained in:
piexel committed 2026-10-06 12:14:34 +02:00
1 parent 93c755ffe4
commit 3465f8d390
19 files changed
+1302 -6

No files matched your search

@@ -1,6 +1,7 @@
package com.volmit.host;
import com.volmit.FeatureAttachment;
import com.volmit.host.schema.PackSchema;
import com.volmit.stage.Pipeline;
import java.util.Collection;
import java.util.List;
@@ -9,11 +10,13 @@ import java.util.Objects;
import java.util.Set;
/** Everything one pack load derives from its modules: the frozen feature catalog (including the
* settings types stages are conditioned on) and one resolved graph per pipeline.
* settings types stages are conditioned on), its description for studio and one resolved graph per
* pipeline.
*/
public record LoadedModules(FeatureCatalog catalog, ResolvedGraph placement, ResolvedGraph chunk) {
public record LoadedModules(FeatureCatalog catalog, PackSchema schema, ResolvedGraph placement, ResolvedGraph chunk) {
public LoadedModules {
Objects.requireNonNull(catalog, "catalog");
Objects.requireNonNull(schema, "schema");
Objects.requireNonNull(placement, "placement");
Objects.requireNonNull(chunk, "chunk");
}
@@ -36,7 +39,9 @@ public record LoadedModules(FeatureCatalog catalog, ResolvedGraph placement, Res
installModule(discovered, stages, registry);
}
stages.settingsTypes(registry::registeredByOwner).forEach(registry::registerStageSettings);
return new LoadedModules(registry.freeze(), stages.resolve(Pipeline.PLACEMENT), stages.resolve(Pipeline.CHUNK));
var catalog = registry.freeze();
var schema = PackSchemaBuilder.describe(catalog, modules);
return new LoadedModules(catalog, schema, stages.resolve(Pipeline.PLACEMENT), stages.resolve(Pipeline.CHUNK));
}
/** The pack load checks that every class a module uses exists, not that every method or field