Giter Club home page Giter Club logo

Comments (8)

Peefy avatar Peefy commented on September 15, 2024 1

If server is deined in schema, we can write code as follows:

server: pkg.Server = pkg.Server {}

If code in pkg.Server as

schema NewServer:
    server:  frontend.Server {
        workloadType = "deployment"
    }

and, we write code in XMixin as

mixin XMixin:
    if True:
        server:  frontend.Server {
           image = "xxxx"
           mainContainer = {}
       }

then, we execute kusion compile, it reports

attribute 'image' of Server is required and can't be None or Undefined

When we execute kusion compile, the values in schema and mixin not merged?

@Peefy

@LeoLiuYan Here, the Server instance will first be created in NewServer, where the check fails. U can write:

If code in pkg.Server as

schema NewServer:
    mixin [XMixin]
    server:  frontend.Server = frontend.Server {
        image = "default_image"
        workloadType = "deployment"
    }

and, we write code in XMixin as

mixin XMixin:
    if True:
        server:  frontend.Server {
           image = "xxxx"
           mainContainer = {}
       }

from konfig.

Peefy avatar Peefy commented on September 15, 2024

If server is deined in schema, we can write code as follows:

server: pkg.Server = pkg.Server {}

from konfig.

Peefy avatar Peefy commented on September 15, 2024

fixed in kcl-lang/kcl#159

from konfig.

LeoLiuYan avatar LeoLiuYan commented on September 15, 2024

If server is deined in schema, we can write code as follows:

server: pkg.Server = pkg.Server {}

If code in pkg.Server as

schema NewServer:
    server:  frontend.Server {
        workloadType = "deployment"
    }

and, we write code in XMixin as

mixin XMixin:
    if True:
        server:  frontend.Server {
           image = "xxxx"
           mainContainer = {}
       }

then, we execute kusion compile, it reports

attribute 'image' of Server is required and can't be None or Undefined

When we execute kusion compile, the values in schema and mixin not merged?

@Peefy

from konfig.

LeoLiuYan avatar LeoLiuYan commented on September 15, 2024

It works, but is redundant.
Is it possible to join first before the check, when a shema includes mixin?

@Peefy

from konfig.

Peefy avatar Peefy commented on September 15, 2024

It works, but is redundant. Is it possible to join first before the check, when a shema includes mixin?

@Peefy

@LeoLiuYan Sure, we will design and optimize this feature with corresponding language proposals in the future.

from konfig.

LeoLiuYan avatar LeoLiuYan commented on September 15, 2024

It works, but is redundant. Is it possible to join first before the check, when a shema includes mixin?
@Peefy

@LeoLiuYan Sure, we will design and optimize this feature with corresponding language proposals in the future.

Cool~ Expect to use this "sugar" feature!

from konfig.

Peefy avatar Peefy commented on September 15, 2024

Related KCLVM Issue: kcl-lang/kcl#92 @LeoLiuYan

from konfig.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.