question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Redundant id key in json schema?

See original GitHub issue

Why is there this additional id key under citationItems? Isn’t that redundant?

Or redundant with a purpose; easier processing?

Example:

{
   "schema":"https://resource.citationstyles.org/schema/latest/input/json/csl-citation.json",
   "citationID":"item1",
   "citationItems":[
      {
         "id":"item1",
         "itemData":{
            "id":"item1",
            "type":"book",
            "title":"test title"
         }
      }
   ]
}

_Originally posted by @bdarcus in https://github.com/citation-style-language/schema/pull/233_

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
bwiernikcommented, Aug 8, 2020

@bdarcus I think the best way to approach this would be to leave citekey just in the data—Essentially as a human-readable alias for id.

1reaction
fbennettcommented, Jul 1, 2020

(I think this is relevant, but correct me if I’m wrong.) This data shape is a processing outcome. The citationItems objects initially carry just the id, locator, and label, and a processor will fetch itemData to the object as a pointer based on the id. In some contexts (bibliographies, sort-key generation) item data is handled as an array of objects, and the id needs to be in there. To remove id from the itemData segment in citations would require cloning the object, which would break pointers, raise memory consumption a bit, and run the risk that multiple metadata representations of the same item would creep into documents. Removing id from the parent citationItems objects would be to delete the id received on input, which might not be a good idea.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Structuring a complex schema — Understanding JSON ...
The identifier for the embedded schema is the value of $id resolved against the Base URI of the schema it appears in. A...
Read more >
JSON Schema Validation Duplicate Key Elements
JSON Schema can only work with valid JSON. This is not valid JSON; you can't have more than one key with the same...
Read more >
Duplicate Keys in JSON - Forums - IBM Support
I've done some research and I understood that "duplicate" keys in JSON ... How can I avoid the use of duplicate keys or,...
Read more >
Template structure and syntax - Azure Resource Manager
$schema, Yes, Location of the JavaScript Object Notation (JSON) schema ... Set the key to the resource ID and the value to an...
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
Tags MUST be limited to those allowed by the JSON Schema ruleset. Keys used in YAML maps MUST be ... The key is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found