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

parser does not raise Exception on missing "resources" #29

Open
wingechr opened this issue Feb 25, 2020 · 4 comments
Open

parser does not raise Exception on missing "resources" #29

wingechr opened this issue Feb 25, 2020 · 4 comments
Assignees

Comments

@wingechr
Copy link
Contributor

The field "resources" should be mandatory (This is also the specification for datapackages)

@wingechr wingechr self-assigned this Feb 25, 2020
@MGlauer MGlauer self-assigned this Mar 5, 2020
@MGlauer MGlauer assigned SharanyaMohan-30 and unassigned wingechr and MGlauer Aug 17, 2020
@SharanyaMohan-30
Copy link
Contributor

Hello Christian,

Currently I am looking into this issue need your inputs for the below-mentioned clarifications:

1)When the Resource section is not available in the JSON file: As per my analysis in the existing source code, we are checking for Mandortory fields such as Resource, Spatial, contribution, etc. In the assert_1_3_metastring method: If mandatory fields are not present we are raising the exception with a specific message as shown in the below code snippet.
for i in keys: if not i in json_dict.keys(): raise Exception( 'The String did not contain the key "{0}"'.format(i) )
We are catching the exception and we are printing the error message there itself should I need to rethrow the exception to the caller???
except Exception as error: print( "The input String does not conform to metadata string version 1.3 standard" ) print(error)

2)Assuming all the mandatory fields present in the JSON file, while parsing do I need to raise an exception if the content of the resource section is empty? or are there any mandatory values that should be present in the Resource section?

@MGlauer
Copy link
Contributor

MGlauer commented Aug 25, 2020

@christian-rli could you help with above question?

@wingechr
Copy link
Contributor Author

wingechr commented Aug 26, 2020

Hi @SharanyaMohan-30

  1. I am not 100% sure but I think the error should not be rethrown
  2. In my opinion, the resources should be a mandatory array containing at least one element of the following structure:
{
	"name": "...",
	"schema": {
		"fields": [
			...
		]
	}
}

This is the description of the table name and column names (and types) in accordance with the datapacke specs

@MGlauer
Copy link
Contributor

MGlauer commented Aug 26, 2020

According to our current JSON-schema spec, there are no mandatory fields in resources (or in the metadata object in general). This is also inconsistent with how OMI works right now because at least id is required. According to documentation json-schema has a property to make fields mandatory - it's just not used yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants