Skip to content

Conversation

@Mpdreamz
Copy link
Member

@Mpdreamz Mpdreamz commented Mar 3, 2021

This ensures the typescript generator traverses the types to find the
behavior and removes the assumption the behavior is on the type itself.

It also makes sure RequestBase and ResponseBase make it to the to
output as these have the behaviors attached to them.

When generating a type because the output is all interfaces this now
collects all extends/implements and behaviors not on the skiplist and
ensures the generated interfaces extends from all.

function isSpecialInterface (type) {
if (Array.isArray(type.attachedBehaviors)) {
// assume types ending with Base are abstract and are not the ones doing the implements
if (type.name.name.endsWith('Base'))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@swallez @delvedor Thoughts on making this explicit in the model? e.g:

Any type that ends with Base gets abstract: true on type unless @not_abstract is specified on the type for edgecases?

Also happy to flip that and explicitly mark classes with @abstract in the input spec.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather be explicit in the input spec rather than rely on implicit naming conventions.

Copy link
Member Author

@Mpdreamz Mpdreamz Mar 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ aggreed, this should be easier once #164 lands

Mpdreamz added 4 commits March 3, 2021 12:39
This ensures the typescript generator traverses the types to find the behavior and removes the assumption the behavior is on the type itself. It also makes sure `RequestBase` and `ResponseBase` make it to the to output as these have the behaviors attached to them. When generating a type because the output is all interfaces this now collects all extends/implements and behaviors not on the skiplist and ensures the generated interfaces extends from all.
@Mpdreamz Mpdreamz force-pushed the fix/behavior-lookup branch from 8321a80 to 19bdc4c Compare March 3, 2021 11:41
Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Can you also update the docs where appropriate?

@Mpdreamz Mpdreamz merged commit cb99f1c into master Mar 3, 2021
@Mpdreamz Mpdreamz deleted the fix/behavior-lookup branch March 3, 2021 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment