citation-file-format/ruby-cff

Error reading CITATION.cff file that validates with jsonschema

rpgoldman opened this issue · 3 comments

I have a CITATION.cff file here: https://github.com/shop-planner/shop3/tree/add-citation that I am able to validate against the cff JSON schema using the python jsonschema script.

However, when I install it on my GitHub repo it does not work: it fails to display the citation tabs (APA and BibTeX) and if I click on the "view the citation file" button, nothing happens.

I wonder if this is related -- when I try to load the file according to the instructions here:

cff = CFF::File.read('CITATION.cff')

I get this error:

       14: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/file.rb:44:in `read'
       13: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/file.rb:44:in `new'
       12: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/file.rb:34:in `initialize'
       11: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/file.rb:34:in `new'
       10: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/model.rb:39:in `initialize'
        9: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/model.rb:89:in `build_model'
        8: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/model.rb:89:in `map!'
        7: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/model.rb:90:in `block in build_model'
        6: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/model.rb:90:in `new'
        5: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/reference.rb:70:in `initialize'
        4: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/reference.rb:223:in `build_model'
        3: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/reference.rb:223:in `each'
        2: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/reference.rb:224:in `block in build_model'
        1: from /Users/rpg/.gem/ruby/2.6.0/gems/cff-0.4.0/lib/cff/util.rb:29:in `build_actor_collection!'
NoMethodError (undefined method `map!' for nil:NilClass)

I'm not a ruby programmer, so this doesn't mean anything to me, but surely this file should load if it satisfies the CFF schema?

I validated with the CFF schema by:

  1. translating CFF to JSON with yq . CITATION.cff > CITATION.json
  2. translating the CFF schema to json similarly: yq . citation-schema.yaml > citation-scheme.json
  3. jsonschema -i CITATION.json citation-schema.json

FILES:
Archive.zip

Hi @rpgoldman, thanks for the report.

This has been fixed on HEAD - it was a similar issue to #56 that got cleaned up at the same time. This update will percolate through to GitHub soon!

Sorry - I should have said that I have confirmed locally that I can load and validate your CITATION.cff file with the current HEAD.

Thank you @hainesr !