Skip to content
This repository was archived by the owner on Jan 21, 2024. It is now read-only.
This repository was archived by the owner on Jan 21, 2024. It is now read-only.

Exposing types on the parsed model objects #27

Description

@pmdartus

Once the model is parsed and resolved, I am attempting to traverse the generated NodeShape tree to gather some information about the shape of our APIs. In order to properly traverse the tree, I need to differentiate between the different types of shapes (NodeShape, ArrayShape, ...). And I haven't found a proper way to do so.

My current workaround is to inspect the different object and retrieve the original class name via the special $classData that is defined on all the Scala objects.

export function isObjectNode(node) {
    return node.$classData.name.endsWith('ObjectNode');
}

It would be great if all the model objects carry along with their types. Or even better if the library provides helper functions like isObject, isArrayNode, ...

Activity

  1. added this to the v0.2.0 milestone on Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions