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

More checks on insert/update #38

Open
1 of 4 tasks
spine-o-bot opened this issue Feb 3, 2021 · 9 comments
Open
1 of 4 tasks

More checks on insert/update #38

spine-o-bot opened this issue Feb 3, 2021 · 9 comments

Comments

@spine-o-bot
Copy link

In GitLab by @manuelma on Dec 14, 2018, 21:14

We have implemented basic and not so basic integrity checks in #4 and #17

This issue is a placeholder for more of these tests we can come up with:

  • Check that input is valid JSON
  • Spine JSON schema (parameter_value)
  • Unique names across tables
  • Forbidden names (such as 'time' for an object class, since time is the name of a function in julia's Base)
@spine-o-bot
Copy link
Author

In GitLab by @manuelma on Dec 14, 2018, 21:14

changed title from More checks on inser/update to More checks on inser{+t+}/update

@spine-o-bot
Copy link
Author

In GitLab by @PekkaSavolainen on Dec 17, 2018, 11:17

changed the description

@spine-o-bot
Copy link
Author

In GitLab by @PekkaSavolainen on Dec 17, 2018, 11:26

I added one task (Check that input is valid JSON). I'm not sure if this is implemented already but it just means that it should not be possible to give input that is invalid JSON, like [2, 3, 4 or something. This could just be a try-except check. Something like the following.

try:
    json.load(someinput)
except json.JSONDecodeError:
    # not valid JSON
    return False
return True

There seems to be some checks for this in the Toolbox already, so this might be done already.

@spine-o-bot
Copy link
Author

In GitLab by @manuelma on Jan 24, 2019, 16:06

changed the description

1 similar comment
@spine-o-bot
Copy link
Author

In GitLab by @manuelma on Jan 24, 2019, 16:06

changed the description

@spine-o-bot
Copy link
Author

In GitLab by @manuelma on Feb 28, 2019, 16:15

I wonder what's the best way to implement the forbidden names? At the moment, if one has a parameter called, e.g., 'length', then SpineModel.JuMP_all_out fails with the following error message:

ERROR: LoadError: error in method definition: function Base.length must be explicitly imported to be
 extended

My guess is it would be difficult to keep a blacklist in spinedatabase_api and perhaps it's better to raise this kind of errors in julia? We could rework the error message to instruct the user to change their parameter name....

@spine-o-bot
Copy link
Author

In GitLab by @jkiviluo on Mar 1, 2019, 12:15

The blacklist should be tool/language specific. It would be nicer to catch it on the Data Store side already, but it's probably impractical. Therefore, the forbidden names could also be in JuMP_all_out for all Julia based tools. It might be that this problem is actually Julia specific since we turn our objects and parameters into function calls. That would not be the case with all languages.

@spine-o-bot
Copy link
Author

In GitLab by @manuelma on Apr 9, 2019, 00:55

mentioned in commit 178d747

@spine-o-bot
Copy link
Author

In GitLab by @manuelma on May 30, 2019, 19:12

marked the task Check that input is valid JSON as completed

@jkiviluo jkiviluo added this to the v1.0 milestone Aug 30, 2023
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

2 participants