Open jryannel opened 6 months ago
Now you can use an import e.g.
name: demo.bbb
version: "1.0"
import: demo.aaa
interfaces:
- name: Counter
properties:
- name: value
type: Value
import: demo.aaa
And IDL:
module demo.bbb 1.0
import demo.aaa
interface Counter {
value: demo.aaa.Value
}
This will allow to use imported types. The YAML side requires a split type (e.g. import: demo.aa
and type: Value
) and the IDL allows to have a unified type (demo.aaa.Value
).
If the import on the module is not stated, a warning will be logged.
In the filter, we check for import:
if schema.IsImported() {
prefix = fmt.Sprintf("%s.", schema.ShortImportName())
}
And in the template we can add the module import:
{{ range .Module.Imports}}
import "{{$.System.Meta.go.module}}/{{path .Name}}"
{{- end }}
As go requires a root module we had to add it to the meta information in the solution doc:
schema: apigear.solution/1.0
targets:
- name: demo
imports: [meta.yaml]
meta: # go module
go:
module: rpc
inputs:
- api/a.idl
- api/b.idl
output: out
template: templ
Allow importing other modules and have a way to reference data types from other modules.