nodestream-proj / nodestream

A Declarative framework for Building, Maintaining, and Analyzing Graph Data
https://nodestream-proj.github.io/docs/
Apache License 2.0
36 stars 10 forks source link

[BUG] Schema Introspection does not work for the switch interpretation. #322

Closed angelosantos4 closed 1 month ago

angelosantos4 commented 2 months ago

Describe the bug For the 'print schema' command, the schema does not generate the context for source nodes involved in the switch interpretations. They do not inherit the relationships and properties declared in the subsequent interpretations.

To Reproduce Create the following interpretation of data:

- implementation: nodestream.interpreting:Interpreter
  arguments:
    interpretations:
    - type: switch
      switch_on: !jmespath 'type'
      cases:
        A:
        - type: source_node
          node_type: AType
          key:
            key: !jmespath 'key'
        B:
        - type: source_node
          node_type: BType
          key:
            key: !jmespath 'key'
      default:
      - type: source_node
        node_type: DefaultType
        key:
          key: !jmespath 'key'
    - type: properties
      properties:
        type: !jmespath 'type'
    - type: relationship
      node_type: InboundNode
      relationship_type: RELATED_FROM
      outbound: false
      node_key:
        related_key: !jmespath 'related_key'
    - type: relationship
      node_type: OutboundNode
      relationship_type: RELATED_TO
      node_key:
        related_key: !jmespath 'related_key'

Then run poetry run nodestream print schema --format graphql -o schema.graphql

Expected behavior For AType, Btype, and DefaultType source nodes, we would expect the schema to have InboundNode and OutboundNode relationships and the 'type' properties for each of them.

Additional context Add any other context about the problem here.

zprobst commented 1 month ago

This is fixed with #333