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

Load guidance limits from JSON file #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

s-l-teichmann
Copy link
Contributor

Add a way to load size guidance from JSON files. First step towards #3

@bernhard-herzog
Copy link
Contributor

I've looked at how one might use these when generating. It's easy to
keep track of where the generator is by passing along a slice of strings
that the generator keeps appending to when descending a level. For
properties it adds the property name, for arrays e.g. a string with
"[]". This way you get arrays like this:

"product_tree", "branches", "[]", "branches", "[]", "product"

now we only need to map that to the corresponding limit, if one exists.
I don't quite see how that easily maps to the LenghtPaths. Two
possibilities:

  • A mapping from a string representation of the above, i.e.
    "product_tree/branches/[]/branches/[]/product", to the
    corresponding limit would be more helpful.

  • An alternative could be a nested mapping where the first level would
    contain the keys document, product_tree, vulnerabilities each
    which maps to a pair of another such mapping, maybe empty, and a
    limit, possibly null to indicate no limit. The generator could take
    this mapping and at during descent extract the appropriate
    sub-map/limit instead of building up a slice of strings.

That being said, I don't mind if we merge this PR and develop it
further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants