Skip to content
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

Feat: scope=given limited execution for schema introspection #756

Merged
merged 14 commits into from
Nov 12, 2023

Conversation

jaromil
Copy link
Member

@jaromil jaromil commented Nov 3, 2023

This new feature adds the possibility to execute zencode limited to the Given and Then section. It also switches off the fatal condition for missing data imported by given, allowing the caller to ignore missing data and obtain a CODEC (schema).

The use-case is that of host applications willing to introspect the data schema accepted by a Zencode contract.

when this conf setting is on only the given and then blocks are
processed, skipping all when as not known (as well if and foreach)
this allows caller applications to import data input before
processing.

work in progress: next will include the possibility to print out the
CODEC as a description of the imported input as well to mark input
that is not found without aborting the operation.
this prints out the internal codec in the json output
this switch and consequent logics allow for missing data as expected
input, which is then listed with CODEC.zentype='n' and not appear in
ACK's heap
still work in progress
@jaromil jaromil requested review from puria and albertolerda November 3, 2023 10:09
@jaromil jaromil self-assigned this Nov 3, 2023
Copy link
Member

@puria puria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is 😍 just tested..

@puria
Copy link
Member

puria commented Nov 4, 2023

@jaromil tested now with a string dict and the codec is not printed... says
[!] [source 'zencode_data']:226: Input encoding not found: string_dictionary
same with string array, number array and so on

@jaromil
Copy link
Member Author

jaromil commented Nov 4, 2023

@puria yes, known bug still WIP. A full list of things left TODO is at bottom of test/zencode/given.bats

@jaromil jaromil marked this pull request as ready for review November 10, 2023 05:29
jaromil and others added 10 commits November 10, 2023 11:38
improved missing detection of dual definition

improve scope=given to support also schema objects

includes complex schemas and keyrings

improve to support also missing objects inside tables
add zenroom. types for binary forms
this new call exposes a direct API for input validation which sets up
all needed configs and should soon also print the codec limiting the
scope to Given
optimize scope=given by disabling When/Then/etc. function handles

no need to process Then when scope=given

on introspection only the Given block is executed and the CODEC is
printed, please note the structure is named uppercase: "CODEC"

includes a small optimization to zencoed parser for comments

add scope test to meson tests
@jaromil jaromil force-pushed the feat/rule_output_given-only branch from ec0136a to 0c55076 Compare November 10, 2023 10:40
@jaromil jaromil merged commit 3dfd69d into master Nov 12, 2023
35 checks passed
@jaromil jaromil deleted the feat/rule_output_given-only branch November 12, 2023 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants