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.

Record vs RecordSet

See original GitHub issue

Both BeerXML 1.0 and the preliminary BeerXML 2.0.1 make a difference between a Record and a RecordSet.

I don’t quite understand the json schema files, but, by looking at the examples in the test directory, I get the impression that everything is treated as a RecordSet in beerjson. Many filenames seem to indicate a single record but they include the plural mentioning the type of record, followed by a list object (although with a single element defining the specific record). Am I reading it wrong or is it really what you want?

For example, instead of the file HopWithRequiredFieldsOnly.json reading

  "beer_xml": {
    "version": 2.01,
    "hop_varieties": [
      {
        "name": "Cascade",
        "origin": "US",
        "alpha_acid_units": 5.5
      }
    ]
  }
}

couldn’t it read

  "beer_xml": {
    "version": 2.01,
    "hop": {
        "name": "Cascade",
        "origin": "US",
        "alpha_acid_units": 5.5
    }
  }
}

Is this allowed?

If not, although it would require more work, wouldn’t it be better to have a json-schema for single records and make the json-schema for record sets to have a list referencing the schema for a single record?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
krutilincommented, Feb 27, 2018

Well, it is possible to make experiments in tests and check it. By default constructions without array will fail validation. We could rewrite root schema in this way:

            "recipes": {
              "description":"Records containing bla bla bla",
              "oneOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "recipes.json#/definitions/RecipeType"
                  }
                },
                {
                  "type": "object",
                  "$ref": "recipes.json#/definitions/RecipeType"
                }
              ]
            },

to archive validation for arrays and single objects. But I can’t understand key reason for it. Brewing software can handle arrays, single objects and arrays with one item without any troubles.

0reactions
rmsrosacommented, Mar 1, 2018

I managed to install the latest Node.js, which already comes with npm, and was able to locally run npm test. Pretty cool. I played a little bit with it, purposely making some erros to see how it goes. But I still need to understand the syntax of json schema to be able to modify it without making a mess. For instance, I tried to adapt in hops.json the modification above that @krutilin suggested on recipes.json to work with either an object or an array but I failed.

Anyway, if I succeed in understanding json-schema, then I might try addressing some of the issues, instead of only making remarks.

I will be following https://spacetelescope.github.io/understanding-json-schema/index.html to learn more about json schemas. It looks nice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Recordset - Wikipedia
A recordset is a data structure that consists of a group of database records, and can either come from a base table or...
Read more >
Record Object (ADO) - Microsoft Learn
A Record object represents one row of data, and has some conceptual similarities with a one-row Recordset. Depending on the capabilities of ...
Read more >
What are Recordsets | Access All In One
Recordsets enable us to reference field names, search for records, filter records, count records and much more. With recordsets, we can ... DAO...
Read more >
What is the difference between RecordSet vs DataSet?
Dataset is a connectionless data holder whereas RecordSet is connection oriented Data holder.Though DataSet you can refer more than 1 table at a ......
Read more >
Is a Dataset the same as a Recordset - Stack Overflow
Datasets vs RecordSets ... Through Dataset you can process more than 1 record,but in case of ... I'm not familiar with anything called...
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