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

Property bags #14

Merged
merged 2 commits into from
Jan 28, 2024
Merged

Property bags #14

merged 2 commits into from
Jan 28, 2024

Conversation

reynir
Copy link
Contributor

@reynir reynir commented Jan 24, 2024

This PR makes propertyBag an object that can contain arbitrary json. The special status of the tags property is not enforced. In order to do so I found it necessary to not derive ord as Yojson.Safe.compare doesn't exist and I was unable to wrestle ATD to use a different function for comparison. I also question the usefulness of such a compare as the order is somewhat arbitrary.

Then I took the test cases for semgrep and added them. I had to do some very minor massaging to make the tests pass: the order of the top level properties in the sarif object had to be reordered, and then I filtered the resulting json through ydump -c to make it compact.

This addressed #10.

The propertyBag is an object with a further constraint that, if present,
the `tags` property is a list of strings. This extra constraint is not
enforced.

"ord", a compare function, is not derived because Yojson.Safe.compare
does not exist. The value of an order is also not clear to me.

A test is added that does a roundtrip of a sarif output taken from a
Semgrep test case.
@gborough
Copy link
Owner

I derived ord initially in order for the check of uniqueness of element to work, but now it seems unnecessary

Copy link
Owner

@gborough gborough left a comment

Choose a reason for hiding this comment

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

I think using abstract/yojson.safe.t is fine

Approved

@gborough gborough merged commit b250fcf into gborough:main Jan 28, 2024
1 check passed
@reynir reynir deleted the propertyBags branch January 29, 2024 10:13
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