home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1302716350

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/datasette/issues/1882#issuecomment-1302716350 https://api.github.com/repos/simonw/datasette/issues/1882 1302716350 IC_kwDOBm6k_c5Npd-- 9599 2022-11-03T21:51:14Z 2022-11-03T22:35:54Z OWNER

Validating this JSON object is getting a tiny bit complex. I'm tempted to adopt https://pydantic-docs.helpmanual.io/ at this point.

The create_model example on https://stackoverflow.com/questions/66168517/generate-dynamic-model-using-pydantic/66168682#66168682 is particularly relevant, especially when I work on this issue:

  • 1863

```python from pydantic import create_model

d = {"strategy": {"name": "test_strat2", "periods": 10}}

Strategy = create_model("Strategy", **d["strategy"])

print(Strategy.schema_json(indent=2)) ``create_model()`: https://pydantic-docs.helpmanual.io/usage/models/#dynamic-model-creation

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
1435294468  
Powered by Datasette · Queries took 1.055ms · About: github-to-sqlite