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

Access output after processing with --remove-additional? #230

Open
herrernst opened this issue Apr 14, 2023 · 1 comment
Open

Access output after processing with --remove-additional? #230

herrernst opened this issue Apr 14, 2023 · 1 comment

Comments

@herrernst
Copy link

Hi, I want to validate JSON data against a schema and drop all non-defined additional attributes. I found the option/switch --remove-additional, but how do I get ajv-cli to output the processed data? I just always get "data.json valid". Thanks

@herrernst
Copy link
Author

Ok, I see --changes outputs changes as JSON patch, so I can apply it a little bit complicated:
ajv --changes=json --remove-additional=all -s schema.json -d data.json | tail -n +3 | patch-json merge data.json -
(tail is needed to skip the "data.json valid" and "changes:" lines)

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

No branches or pull requests

1 participant