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

CSL-JSON hardening #109

Merged
merged 11 commits into from
May 17, 2021
Merged

CSL-JSON hardening #109

merged 11 commits into from
May 17, 2021

Conversation

cormacrelf
Copy link
Collaborator

Fixes #92, fixes #99

Basically adds a big test suite for the JSON input, some of which is generated from the schema itself, and hammers the Deserialize impl with inputs. The guiding principle is that anything within the schema should not fail to parse with an Error, and many more things should be silently ignored. I think the one thing left is that the schema says "number" everywhere but should probably say "integer" instead, so I don't know what happens with floating point inputs.

  • a rollup of a bunch of other things, too annoying to wait for multiple PR test suites.

Last commit fixes the most things.

  • Support dates like "issued": {"year": 1995}
  • add a release flag to test-suite run
  • switch to the new cargo resolver from 1.51
  • Fix a whole bunch of warnings
  • disamb/names documentation improvements
  • delete comment about pandoc dates being incompatible
  • add JSON input test suite
  • ignore unknown keys in CSL-JSON
  • add shortTitle -> title-short alias, fixes Error: unknown field shortTitle, expected any CSL variable #92
  • add test for duplicate keys in CSL-JSON
  • harden & test CSL-JSON Reference input pretty thoroughly

technically `literal` and `year` keys are in CSL-JSON
or at least they are now
- updated serde because I thought it would fix an issue,
  may as well keep it
all this was done through the new crates/io/tests/json
test suite.

test:
- parses the JSON schema to auto-generate test cases
- tests for unknown variables
- tests all classes of variable are parsed as the correct
  AnyVariable variant
- tests that these tests are exhaustive

test-suite:
- adds date_IsUncertainDate as a pure boolean test

dates:
- also fixes <if is-uncertain-date="issued"> not being implemented
  (it passed date_Uncertain spuriously, because it rendered circa term anyway)
- ignores unrecognised fields in dates
- ignores additional entries in date-parts arrays
- ignores more invalid values
- accepts bool for circa
- stores circa on literal as well
- log warnings for many cases

variables:
- adds _everything_ from the latest CSL-JSON schema
@cormacrelf cormacrelf merged commit d355c39 into master May 17, 2021
@cormacrelf cormacrelf deleted the csl-json branch May 17, 2021 02:22
@cormacrelf cormacrelf added A-core Area: affects all builds of citeproc-rs enhancement New feature or request A-internals Area: internal implementation details A-crates/csl Area: csl crate labels Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: affects all builds of citeproc-rs A-crates/csl Area: csl crate A-internals Area: internal implementation details enhancement New feature or request
1 participant