Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libdoc: Store information about enums and TypedDicts used as argument types in spec files #3607

Closed
fabioz opened this issue Jun 29, 2020 · 6 comments · Fixed by #3743
Closed

Comments

@fabioz
Copy link
Contributor

fabioz commented Jun 29, 2020

This is from the discussion in: https://robotframework.slack.com/archives/C015KB1QSDN/p1593278603282300?thread_ts=1593190150.106700&cid=C015KB1QSDN

I don't have a ready-made solution, so, how to do it is up to discussion...

One suggestion: add the enums used by the libspec to the libspec.

i.e.: something as

<enums>
  <enum name="MyEnum">
    <value name="Emun1" value="val1"/>
    <value name="Emun2" value="val2"/>
  </enum>
</enums>

Then we could add <arg type="MyEnum">myarg</arg> in the libpsec (or officialize the myarg: MyEnum=Enum1, which is already being used) so that the language server could identify that properly.

@fabioz
Copy link
Contributor Author

fabioz commented Jul 6, 2020

@pekkaklarck what do you think about the idea? Do you have any suggestions?

@pekkaklarck
Copy link
Member

This idea sounds good to me but I'm not certain what's the best way to implement it. Need to think about that more and should also think how to show enums in Libdoc HTML outputs.

I don't think we can do changes to Libdoc specs in a patch version like RF 3.2.2 so need to wait for RF 3.3 or whatever the next bigger release will be.

@xylix
Copy link
Contributor

xylix commented Jul 23, 2020

We had a discussion with BrowserLibrary team at what our use case for this would be and for our documentation it would make most sense if we could have a types section after the keywords section containing all the enums (which we could expose via some get_data_types librarymethod). And then the keyword specific docs could link to those enums wherever they are mentioned.

@pekkaklarck pekkaklarck changed the title Enhance libspec so that it's possible to provide code-completion and validation for enum arguments Libdoc: Enhance specs so that it's possible to provide code-completion and validation for enum arguments Nov 23, 2020
@Snooz82
Copy link
Member

Snooz82 commented Nov 29, 2020

XML have now this format:

<enum name="AssertionOperator">
  <doc>This is some Doc

  This has was defined by assigning to __doc__.</doc>
  <members>
    <member name="equal" value="=="/>
    <member name="==" value="=="/>
    <member name="&lt;" value="&lt;"/>
    <member name="&gt;" value="&gt;"/>
    <member name="&lt;=" value="&lt;="/>
    <member name="&gt;=" value="&gt;="/>
  </members>
</enum>

JSON:

"enums": [
      {
        "name": "AssertionOperator",
        "type": "Enum",
        "doc": "<p>This is some Doc</p>\n<p>This has was defined by assigning to __doc__.</p>",
        "members": [
          {
            "name": "equal",
            "value": "=="
          },
          {
            "name": "==",
            "value": "=="
          },
          {
            "name": "<",
            "value": "<"
          },
          {
            "name": ">",
            "value": ">"
          },
          {
            "name": "<=",
            "value": "<="
          },
          {
            "name": ">=",
            "value": ">="
          }
        ]
      }
    ]

@Snooz82 Snooz82 linked a pull request Nov 29, 2020 that will close this issue
@Snooz82
Copy link
Member

Snooz82 commented Nov 30, 2020

Related to
#3783 Libdoc: Stored data types should be documented in LibDoc HTML
#3784 Libdoc: TypedDict types shall be documented in spec files as Enums are.

@pekkaklarck pekkaklarck changed the title Libdoc: Enhance specs so that it's possible to provide code-completion and validation for enum arguments Libdoc: Store information about enums and TypedDicts used as argument types in spec files Nov 30, 2020
@pekkaklarck
Copy link
Member

Let's merge this issue with storing TypedDict info in specs (#3784). They be implemented by the same PR (#3743) and have common issue about showing the info in HTML (#3783).

pekkaklarck pushed a commit that referenced this issue Nov 30, 2020
Add them to specs (#3607) and show in HTML (#3783).

Few things still to be fixed. See PR #3743 for details.
vokiput pushed a commit to vokiput/robotframework that referenced this issue Dec 27, 2020
Add them to specs (robotframework#3607) and show in HTML (robotframework#3783).

Few things still to be fixed. See PR robotframework#3743 for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants