gabotechs / graphqxl

GraphQXL is a new language built on top of the GraphQL syntax that extends the original language with some additional features useful for creating scalable and big server side schemas. This repository contains the source code for the GraphQXL compiler.
https://gabotechs.github.io/graphqxl
MIT License
272 stars 8 forks source link

Allow templating string for inherited and generics #30

Closed gabotechs closed 1 year ago

gabotechs commented 1 year ago

For generics there could be something like

"""
This is a $T
"""
type Generic<T> {
    " This is a description for $T.foo"
    foo: T
}

For inheritance something like

type _Common {
   " field $PARENT.foo "
    foo: String!
}
gabotechs commented 1 year ago

implemented in #32, but it is a bit more complex than in the example above: this is a working example:

"I am ${{ block.name }}, and my arguments are ${{ variables.T }} and ${{ variables.U }}"
type Generic<T U> {
    "I am ${{ variables.T }}"
    t: T
    "I am ${{ variables.U }}"
    u: U
}

type Concrete = Generic<String, Int>

will compile to

"I am Concrete, and my arguments are String and Int"
type Concrete {
    "I am String"
    t: String
    "I am Int"
    u: Int
}