mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-26 01:06:00 +03:00
[GH-ISSUE #3758] [feature]: use python'sTypedDict in codegen #1308
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1308
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KraXen72 on GitHub (Jan 17, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3758
Is there an existing issue for this?
Summary
Python now has a better way to define type definitions than the one that's currently used - see https://peps.python.org/pep-0589/
Why should this be worked on?
In my opinion it's better to utilize python's typing system, rather than generate whole classes.
Some TypedDict code:
This will be type-checked in VSCode with these settings:
Sometimes, api's have keys for json that cannot be defined this way, due to them not being valid identifiers (like when the key contains a hyphen). In that case, according to the spec, the function syntax must be used:
TypedDict is supported from python version 3.8, which is pretty widely available now.