-
Notifications
You must be signed in to change notification settings - Fork 664
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
Upgrade rpctypegen to new Borsh Schema format #2242
Comments
Borsh schema does not necessarily match the JSON schema (e.g. some values can be base64-encoded, some fields/enum variants are renamed, etc). Unfortunately, I don't think it is feasible to try to fit Borsh schema for JSON schema. Please, reopen if you think otherwise. |
Borsh schema is not Borsh-specific. We call it Borsh schema because it is defined in Borsh library but it can be used by many serializers. Our current schema generated by |
Nice! Then, for the future context, we need to make sure that whatever schema-generation we use should respect the serialization annotations (currently, we extensively use serde renamings, enum representations, and skips). There are OpenAPI spec generators for serde out there for inspiration: https://docs.rs/rweb/0.4.3/rweb/openapi/index.html |
This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. |
looks like a duplicate of #1972 |
rpctypegen generates Borsh schema in TS format for all RPC errors.
Now that we have implemented
BorshSchema
macro in near/borsh#57 and near/borsh#56 we can use#[derive(BorshSchema)]
to generate schema for RPC errors and reduce our code base. We would also need to do two more things:nearcore/tools
that has a hardcoded list of error types. The executable would iterate over the error types and for each of them generate Borsh Schema usingBorshSchema
trait it then would dump the schema into a file that we can hardcode in nearlib.The text was updated successfully, but these errors were encountered: