strictdoc-project / strictdoc

Software for technical documentation and requirements management.
https://strictdoc.readthedocs.io/en/stable/
Other
151 stars 24 forks source link

CUSTOM GRAMMAR links issues #1928

Closed elfman2 closed 1 month ago

elfman2 commented 2 months ago

version 0.0.58 Cannot link doc A / RULE to parent B / OBJECTIVE

if grammar for REQUIREMENT is not present: => KeyError: 'REQUIREMENT' else: => KeyError: 'RULE'

Custom grammar for doc A:

- TAG: RULE
  FIELDS:
  - TITLE: UID
    TYPE: String
    REQUIRED: False
  - TITLE: TITLE
    TYPE: String
    REQUIRED: False
  - TITLE: STATEMENT
    TYPE: String
    REQUIRED: False
  RELATIONS:
  - TYPE: Parent
    ROLE: to trace objective

Custom grammar for doc B:

- TAG: OBJECTIVE
  FIELDS:
  - TITLE: UID
    TYPE: String
    REQUIRED: False
  - TITLE: TITLE
    TYPE: String
    REQUIRED: False
  - TITLE: STATEMENT
    TYPE: String
    REQUIRED: False
stanislaw commented 2 months ago

Hi @elfman2, thanks for reporting this.

I tried to reproduce this issue and couldn't. Here's an integration test that I created based on your input and it is passing for me: https://github.com/strictdoc-project/strictdoc/compare/stanislaw/custom_grammar_link?expand=1.

Apparently, there is some other detail in your setup that leads to an error. Could you share which other details I should add to my itest?

elfman2 commented 1 month ago

Hi Stanislav, now if you try to add a new link with the web UI: element: GrammarElement = grammar.elements_by_type["REQUIREMENT"] KeyError: 'REQUIREMENT' Nicolas

elfman2 commented 1 month ago

And if you add REQUIREMENT to the grammar, and you use the UI to add a new link target_requirement.document.grammar.elements_by_type[ KeyError: 'RULE'

stanislaw commented 1 month ago

@elfman2

pip install strictdoc --pre

The issue should be fixed now.

From what I know so far, the custom nodes editing and linking using UI hasn't received enough testing. Please let us know if you encounter any further issues.