Skip to content

[ENHANCEMENT] TypedDict linting improvement #468

Open
@Heck-R

Description

@Heck-R

Is your enhancement request related to a problem? Please describe.
Lately I had to create some GRPC clients, where there is no good "robot framework" way to parameterize requests when they have parameters with nested objects (I have no control over the protocol, having these is a sad fact of life).

I was quite happy when I realized that RoF has an inline dictionary syntax, and robotcode even lints it to some extent when using TypedDicts, but I also quickly realized that even though it's pretty cool, it only works for the "top level", and doesn't lint the dictionary values themselves(, or sub-dictionary values)

I realize that the whole thing by nature is somewhat of an anti-pattern in RoF, but sometimes RoF's own syntax itself is an anti-pattern to more complicated things that are inevitable, which is likely why the inline dictionary declaration became a thing in the first place.

See images in the context section

Describe the solution you'd like
I would like the TypedDict linting in keyword arguments to work for the values of the dict the same or in a similar way as it works for top level keyword arguments

Describe alternatives you've considered
The alternative I'm currently using is creating keywords for every TypedDict, which allows to build the entire dict from the bottom up, but referencing / finding the helper keywords, and actually building these is a huge pain

"Shallowing" everything to the top level is also an option, but there are either name collisions there, or things start to have very weird naming, and it's generally harder to convey the use of a parameter when it is not grouped with its relevant values, especially when there are relatively many parameters overall. Also, for those who may want to extract some parts of the dict separately for multiple similar dicts (GRPC messages in my case, for which this happens a lot) this makes it impossible due to the inevitably inconsistent naming

Alternatively I can manage figuring out the types by jumping through the type definitions, but many testers for whom I'm making the client can't.

Additional context
Normal usage (pretty nice)
Image
Image

It kinda shows the types
Image

But There is no actual linting or checking
Image

Although it's not that big of a deal for primitive types, more special ones like enums and nested TypedDicts would be very very useful to have linting and static type checking for.

E.g. for
Image
the enum parameter is nice
Image
but the one inside the dict and the other dict are not
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions