19 lines
685 B
V
19 lines
685 B
V
module generator
|
|
|
|
import freeflowuniverse.herolib.core.code { Folder, IFile, VFile, CodeItem, File, Function, Param, Import, Module, Struct, CustomCode }
|
|
import freeflowuniverse.herolib.core.texttools
|
|
import freeflowuniverse.herolib.schemas.jsonschema.codegen {schema_to_struct}
|
|
import freeflowuniverse.herolib.baobab.specification {ActorMethod, ActorSpecification}
|
|
|
|
pub fn generate_model_file(spec ActorSpecification) !VFile {
|
|
actor_name_snake := texttools.snake_case(spec.name)
|
|
actor_name_pascal := texttools.snake_case_to_pascal(spec.name)
|
|
|
|
return VFile {
|
|
name: 'model'
|
|
items: spec.objects.map(CodeItem(
|
|
Struct {...schema_to_struct(it.schema)
|
|
is_pub: true
|
|
}))
|
|
}
|
|
} |