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

None/none/null default value in plasma configuration schema #633

Closed
ftsamis opened this issue Jul 24, 2016 · 5 comments
Closed

None/none/null default value in plasma configuration schema #633

ftsamis opened this issue Jul 24, 2016 · 5 comments

Comments

@ftsamis
Copy link
Member

ftsamis commented Jul 24, 2016

Something that had occurred when I was converting tardis_config_definition.yml to JSON Schema was the default values of None which sometimes were mistakenly expressed as none.

When the word None didn't start with a capital N, the (old) validator translated it as a string. The two cases were this happened are plasma.helium_treatment and plasma.heating_rate_data_file

For example, in the plasma.heating_rate_data_file case its default value was set to none but the code is comparing to the python object None, making the code have no effect.

This bug has survived after the conversion to JSON Schema, since only what the old validator was translating as python None was converted to jsonschema null (which is the way to say python None in jsonschema). This was left out on purpose because it was out of scope for the particular task, and changes in the code needed to be done to solve it.

Finally, we should discuss dropping None/null as a default value altogether, since the only thing it offers is not having to check in the code if the property was provided by the configuration file, i.e. it only saves us from doing:

if 'helium_treatment' in config.plasma:
    helium_treatment = config.plasma.helium_treatment
else:
    helium_treatment = None

but there are nice workarounds to this, such as

helium_treatment = config.plasma.get('helium_treatment', None)
@unoebauer
Copy link
Contributor

Status?

@ftsamis
Copy link
Member Author

ftsamis commented Nov 19, 2016

This is still an issue. Let's please fix it after #652 is merged or as part of it.

@ftsamis ftsamis added the easy label Dec 25, 2016
@nitinkgp23
Copy link

@ftsamis I am a newcomer here, and I would like to work on this issue. Can you help me in getting forward with it?

@ftsamis
Copy link
Member Author

ftsamis commented Jan 27, 2017

Feel free to ask any specific questions.

@unoebauer
Copy link
Contributor

Closing due to inactivity - reopen if necessary.

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

No branches or pull requests

3 participants