-
Notifications
You must be signed in to change notification settings - Fork 116
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
ExtractSchema() does not consider option
type
#1252
Comments
ExtractSchema is missing some important details (i.e. there is no distinction between "or" and "pair" types, "option" type is not marked as optional). A new method called "generateSchema" has been implemented and is intended to replace the "ExtractSchema" method. "generateSchema" provides a more accurate and uniform schema representation. BREAKING CHANGE: The schema representation is different between ExtractSchema and generateSchema method. ExtractSchema will be marked as deprecated and the migration to generateSchema will incur breaking change. re #1252, re #1303, re #1304
@psmolinsky I would like to know if the proposed solution seems convenient for you. Here is a link to preview builds: #1316 (comment) Examples:The michelson type: { prim: 'option', args: [{ prim: 'int' }], annots: [] } will be represented as follow by the generateSchema method:
The michelson type: { prim: 'pair', args: [{ prim: 'int', annots: ['test'] }, { prim: 'string', annots: ['test2'] }], } will be represented as follow by the generateSchema method:
The michelson type: { prim: 'map', args: [{ prim: 'string' }, { prim: 'int' }], annots: [] } will be represented as follow by the generateSchema method:
|
Improved the |
Great move, thanks. It makes the schema object much less ambiguous. |
ExtractSchema is missing some important details (i.e. there is no distinction between "or" and "pair" types, "option" type is not marked as optional). A new method called "generateSchema" has been implemented and is intended to replace the "ExtractSchema" method. "generateSchema" provides a more accurate and uniform schema representation. BREAKING CHANGE: The schema representation is different between ExtractSchema and generateSchema method. ExtractSchema will be marked as deprecated and the migration to generateSchema will incur breaking change. re #1252, re #1303, re #1304
Description
Schema.ExtractSchema()
method does not consider theoption
type. This make it indistinguishable if theoption
is there or not.Steps To Reproduce
Schema
with Michelson containing theoption
type and call the method."nat"
option
and call the method"nat"
Expected behavior
The
option
type should be expressed in the extracted schema. For example in the step 2 the result could be"option nat"
or an object{ option: "nat" }
. The step 4 could stay as it is.The text was updated successfully, but these errors were encountered: