-
Notifications
You must be signed in to change notification settings - Fork 382
Schema codegen #2508
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
base: main
Are you sure you want to change the base?
Schema codegen #2508
Conversation
1b2bcfb
to
1ddefa1
Compare
434d799
to
bb024bd
Compare
9d27401
to
b4662af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done a lot of bug fixes and some improvements in terms of tests, but there are still some problems here. Especially testing needs improvement.
For some reason the coverage job is also failing, even though the test works fine locally.
cw_schema::NodeType::Double => "z.number()".into(), | ||
cw_schema::NodeType::Boolean => "z.boolean()".into(), | ||
cw_schema::NodeType::String => "z.string()".into(), | ||
cw_schema::NodeType::Integer { .. } => "z.string().or(z.number())".into(), // TODO: is this correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems with the way this whole thing is set up, we cannot distinguish between stringified integers (like Uint128
, etc.) and normal ones (like u128
). Probably should have caught that during the review without codegen.
{{ doc }} | ||
{% endfor %}""" | ||
{% for field in fields %} | ||
{{ field.name }}: {{ field.ty }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately we need some sort of handling for keywords here. E.g. the crypto-verify
contract uses from
as a field name, which causes invalid python code to be generated here.
No description provided.