apigear-io / cli

The ApiGear client as go project
https://apigear.io
MIT License
1 stars 2 forks source link

extending interfaces #131

Open jryannel opened 6 months ago

jryannel commented 6 months ago

The idea is to allow interfaces to extend other interfaces.

E.g.

interface A {}
interface B extends A {}

in YAML this would be

interfaces:
  - name: B
    extends: A

For C++ we would extend one interface with another:

class B extends A {};
jryannel commented 5 months ago

Now you can extend interface using the extends keyword:

IDL

interface Common {
}

interface Counter extends Common {
}

or using an external type:

import demo

interface Counter extends demo.Common {
}

YAML

name: demo.bbb
version: "1.0"

imports: 
  - name: demo.aaa

interfaces:
  - name: Common
  - name: Counter
    extends:
      name: Common
      import: demo.aaa

Template

In the go template we can then access the extends information: