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

JSON schema does not add default values to configuration dictionary #81

Open
edoput opened this issue Jun 5, 2017 · 5 comments
Open

Comments

@edoput
Copy link
Contributor

edoput commented Jun 5, 2017

Right now we have a lot of material specified in the schema for a backend but it is not used to fill the defaults for the user, so what is the benefit of having so much precise schema if it is not doing something for us?

Obviously this is a rant/question/"what would we like to do question", so please chime in and let's sort it out

@nemesifier
Copy link
Member

The default values are used by UI generators, eg: in the admin interface of OpenWISP, or in the netjsonconfig-editor.js project on which @gastonche is working.

Maybe there's a way to get a python dictionary filled with the default values of the schema via the jsonschema library, but I'm not sure.

I understand that AirOS needs a full configuration in order to work, so you need to keep a default config somewhere, let's try to go deeper, what's exactly you need / want to do? Can you work around this need without introducing too much complexity to the library?

@edoput
Copy link
Contributor Author

edoput commented Jun 5, 2017

AirOS needs a full configuration in order to work, so you need to keep a default config somewhere

I have been doing the defaults in the converters but I have many 'KeyError' poppings out during testing that (maybe) could be sorted out at jsonschema level

Can you work around this need without introducing too much complexity to the library?

I think that yes I can do this without too much work but I should really look and see if jsonchema can do this on our behalf

@edoput
Copy link
Contributor Author

edoput commented Jun 19, 2017

If you are still interested in breaking every tests we have in one commit here is what I have worked on https://github.com/EdoPut/netjsonconfig/tree/computer-do-the-thing

@nemesifier
Copy link
Member

Looks interesting. I'm a bit overloaded now, but at some point in the near future I want to go back to analyse what could possibly go wrong in changing the current implementation to adopt that change and make it work for all backends.

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

2 participants