cia_world_factbook_api icon indicating copy to clipboard operation
cia_world_factbook_api copied to clipboard

Formalise schema

Open iancoleman opened this issue 6 years ago • 5 comments

When the parser becomes a bit more mature it would be good to have a formal schema available

Something like http://json-schema.org/

I have a feeling there's still some bits and pieces that are inconsistent

eg I think percentage values are represented in two different ways

{"percent": 1.5}
vs
{"value": 1.5, "units": "%"}

iancoleman avatar Sep 27 '17 00:09 iancoleman

Some additional useful links from datasets/registry issue 201 referenced above

i'm thinking about packaging (some of the data) as tabular data packages:

http://frictionlessdata.io/data-packages/ http://frictionlessdata.io/guides/tabular-data-package/

https://specs.frictionlessdata.io/tabular-data-resource/

Especially adding a Table Schema https://specs.frictionlessdata.io/table-schema/

iancoleman avatar Oct 02 '17 00:10 iancoleman

@iancoleman note that Table Schema has a pattern for adding units: https://github.com/frictionlessdata/specs/issues/216.

rufuspollock avatar Oct 03 '17 09:10 rufuspollock

The JSON names are not in Pascal Case. If they were converted to PascalCase they would directly translate into classes better.

Currently I get an automatic JSON conversion to a C# class that looks as follows. As you can see this is less than optimal from the var/method naming deserialization perspective.


public class Electricity
{
    public Access access { get; set; }
    public Production production { get; set; }
    public Consumption consumption { get; set; }
    public Exports exports { get; set; }
    public Imports imports { get; set; }
    public InstalledGeneratingCapacity installed_generating_capacity { get; set; }
    public BySource by_source { get; set; }
}

NinerXrayBravoTwoTwo avatar May 22 '19 20:05 NinerXrayBravoTwoTwo

Is it possible for the names to be in pascal case? This would make importing it more consistent and deserializing it directly to objects cleaner.

NinerXrayBravoTwoTwo avatar Jun 30 '19 07:06 NinerXrayBravoTwoTwo

I did some looking at conventions and the best I came up with (google JSON style guide) recommends camelCase.

Would camelCase be ok or would you specifically prefer PascalCase?

iancoleman avatar Jul 01 '19 00:07 iancoleman