You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by DeWayne Filppi <de...@cloudify.co> on 2017/11/28 16:56:53 UTC

TOSCA type inheritance question

If there is a node type that inherits from another node type, can a
property in the parent be overridden by the subtype?  I'm having trouble
getting a straight answer to that basic question from the spec.

DeWayne

Re: TOSCA type inheritance question

Posted by DeWayne Filppi <de...@cloudify.co>.
Yes, that branch validates it without error.

On Tue, Nov 28, 2017 at 9:20 AM, Tal Liron <ta...@cloudify.co> wrote:

> This is a big that is fixed in the ARIA-1 commit, which is waiting to be
> merged.
>
> If you don't mind helping to test, could you try with this branch?
> https://github.com/apache/incubator-ariatosca/tree/ARIA-
> 1-parser-test-suite
>
> On Tue, Nov 28, 2017 at 11:13 AM, DeWayne Filppi <de...@cloudify.co>
> wrote:
>
> > I made a simple example that fails.  Maybe my example is a
> > misinterpretation of what you said:
> >
> > tosca_definitions_version: tosca_simple_yaml_1_0
> >
> > imports:
> >
> >   - aria-1.0
> >
> > data_types:
> >
> >   d1:
> >     properties:
> >       p1:
> >         type: string
> >
> >   d2:
> >     derived_from: d1
> >     properties:
> >       p2:
> >         type: string
> >
> > node_types:
> >
> >   T1:
> >     derived_from: tosca.nodes.Root
> >     properties:
> >       n1:
> >         type: d1
> >
> >
> >   T2:
> >     derived_from: T1
> >     properties:
> >       n1:
> >         type: d2
> >
> >
> > This produces the error:
> >
> >   4: override changes type from "d1" to "d2" for property "n1" in "T2
> >
> > On Tue, Nov 28, 2017 at 9:00 AM, Tal Liron <ta...@cloudify.co> wrote:
> >
> > > You are correct that it's not entirely clear from the spec. However, I
> > > always interpret the spirit of the spec to be object-oriented. That
> means
> > > that in ARIA: yes, you can override a property, AS LONG AS the property
> > > type is of compatible with (equal or derived from) the one in the
> parent.
> > > ARIA will check for this and issue a validation error if you break the
> > > parent's contract.
> > >
> > > On Tue, Nov 28, 2017 at 10:56 AM, DeWayne Filppi <de...@cloudify.co>
> > > wrote:
> > >
> > > > If there is a node type that inherits from another node type, can a
> > > > property in the parent be overridden by the subtype?  I'm having
> > trouble
> > > > getting a straight answer to that basic question from the spec.
> > > >
> > > > DeWayne
> > > >
> > >
> >
>

Re: TOSCA type inheritance question

Posted by Tal Liron <ta...@cloudify.co>.
This is a big that is fixed in the ARIA-1 commit, which is waiting to be
merged.

If you don't mind helping to test, could you try with this branch?
https://github.com/apache/incubator-ariatosca/tree/ARIA-1-parser-test-suite

On Tue, Nov 28, 2017 at 11:13 AM, DeWayne Filppi <de...@cloudify.co>
wrote:

> I made a simple example that fails.  Maybe my example is a
> misinterpretation of what you said:
>
> tosca_definitions_version: tosca_simple_yaml_1_0
>
> imports:
>
>   - aria-1.0
>
> data_types:
>
>   d1:
>     properties:
>       p1:
>         type: string
>
>   d2:
>     derived_from: d1
>     properties:
>       p2:
>         type: string
>
> node_types:
>
>   T1:
>     derived_from: tosca.nodes.Root
>     properties:
>       n1:
>         type: d1
>
>
>   T2:
>     derived_from: T1
>     properties:
>       n1:
>         type: d2
>
>
> This produces the error:
>
>   4: override changes type from "d1" to "d2" for property "n1" in "T2
>
> On Tue, Nov 28, 2017 at 9:00 AM, Tal Liron <ta...@cloudify.co> wrote:
>
> > You are correct that it's not entirely clear from the spec. However, I
> > always interpret the spirit of the spec to be object-oriented. That means
> > that in ARIA: yes, you can override a property, AS LONG AS the property
> > type is of compatible with (equal or derived from) the one in the parent.
> > ARIA will check for this and issue a validation error if you break the
> > parent's contract.
> >
> > On Tue, Nov 28, 2017 at 10:56 AM, DeWayne Filppi <de...@cloudify.co>
> > wrote:
> >
> > > If there is a node type that inherits from another node type, can a
> > > property in the parent be overridden by the subtype?  I'm having
> trouble
> > > getting a straight answer to that basic question from the spec.
> > >
> > > DeWayne
> > >
> >
>

Re: TOSCA type inheritance question

Posted by DeWayne Filppi <de...@cloudify.co>.
I made a simple example that fails.  Maybe my example is a
misinterpretation of what you said:

tosca_definitions_version: tosca_simple_yaml_1_0

imports:

  - aria-1.0

data_types:

  d1:
    properties:
      p1:
        type: string

  d2:
    derived_from: d1
    properties:
      p2:
        type: string

node_types:

  T1:
    derived_from: tosca.nodes.Root
    properties:
      n1:
        type: d1


  T2:
    derived_from: T1
    properties:
      n1:
        type: d2


This produces the error:

  4: override changes type from "d1" to "d2" for property "n1" in "T2

On Tue, Nov 28, 2017 at 9:00 AM, Tal Liron <ta...@cloudify.co> wrote:

> You are correct that it's not entirely clear from the spec. However, I
> always interpret the spirit of the spec to be object-oriented. That means
> that in ARIA: yes, you can override a property, AS LONG AS the property
> type is of compatible with (equal or derived from) the one in the parent.
> ARIA will check for this and issue a validation error if you break the
> parent's contract.
>
> On Tue, Nov 28, 2017 at 10:56 AM, DeWayne Filppi <de...@cloudify.co>
> wrote:
>
> > If there is a node type that inherits from another node type, can a
> > property in the parent be overridden by the subtype?  I'm having trouble
> > getting a straight answer to that basic question from the spec.
> >
> > DeWayne
> >
>

Re: TOSCA type inheritance question

Posted by DeWayne Filppi <de...@cloudify.co>.
Spec needs a touch of refactoring.  Thanks.

On Tue, Nov 28, 2017 at 9:00 AM, Tal Liron <ta...@cloudify.co> wrote:

> You are correct that it's not entirely clear from the spec. However, I
> always interpret the spirit of the spec to be object-oriented. That means
> that in ARIA: yes, you can override a property, AS LONG AS the property
> type is of compatible with (equal or derived from) the one in the parent.
> ARIA will check for this and issue a validation error if you break the
> parent's contract.
>
> On Tue, Nov 28, 2017 at 10:56 AM, DeWayne Filppi <de...@cloudify.co>
> wrote:
>
> > If there is a node type that inherits from another node type, can a
> > property in the parent be overridden by the subtype?  I'm having trouble
> > getting a straight answer to that basic question from the spec.
> >
> > DeWayne
> >
>

Re: TOSCA type inheritance question

Posted by Tal Liron <ta...@cloudify.co>.
You are correct that it's not entirely clear from the spec. However, I
always interpret the spirit of the spec to be object-oriented. That means
that in ARIA: yes, you can override a property, AS LONG AS the property
type is of compatible with (equal or derived from) the one in the parent.
ARIA will check for this and issue a validation error if you break the
parent's contract.

On Tue, Nov 28, 2017 at 10:56 AM, DeWayne Filppi <de...@cloudify.co>
wrote:

> If there is a node type that inherits from another node type, can a
> property in the parent be overridden by the subtype?  I'm having trouble
> getting a straight answer to that basic question from the spec.
>
> DeWayne
>