Gowee / json2pyi

Generate Python type definitions from a JSON sample (both Pydantic BaseModel and TypedDict are supported)
https://json2pyi.pages.dev
44 stars 1 forks source link

Save and restore last target when accessing the page again #5

Closed s-rigaud closed 1 year ago

s-rigaud commented 1 year ago

Hi 👋 First of all, thanks ! Your project saved me a lot of hours for personal projects 😄

I think it might be a good feature to keep the target saved between two access to the page. For example, I mainly use your website to generate Pydantic models and I don't care about the others. It would be nice to have it set to Pydantic each time 😃

I just updated the tsx file, you still need to build the project and to publish it. I hope you will implement this feature soon !

Gowee commented 1 year ago

Hi, s-rigaud.

To make the target in the URL hash still relevant, I tweak the code slightly: https://github.com/Gowee/json2pyi/commit/caf78fa2869c33655fd1900fae8162ae0578fee0

These should allow restoring the target from the URL hash in addition to localStorage. I have tested on Chrome/Firefox, to find the URL without hash always takes higher priority in the address bar. So they should work like a charm without interfering with each other. In case there is still any issue around this in other cases, please let me know.

Thanks for your contribution!

Gowee commented 1 year ago

The new build of Web app appears to be blocked by https://github.com/rustwasm/wasm-pack/issues/1248. Hopefully to be resolved soon.

s-rigaud commented 1 year ago

Can't you downgrade to a previous version to build the website ?

Gowee commented 1 year ago

It is an external dep that is out of the control of the lock file. I just tweaked the build script on pages.dev as a temporary fix. Now the new build has been deployed: https://github.com/Gowee/json2pyi/runs/12218782428.