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
Fix part of #13162: added schemas for SkillMasteryDataHandler #14395
Changes from 2 commits
46787a8
66af425
1053e4d
8143b0a
c26c9ab
6628376
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
from core import utils | ||
from core.controllers import acl_decorators | ||
from core.controllers import base | ||
from core.controllers import domain_objects_validator | ||
from core.domain import skill_domain | ||
from core.domain import skill_fetchers | ||
from core.domain import skill_services | ||
|
@@ -33,6 +34,25 @@ class SkillMasteryDataHandler(base.BaseHandler): | |
""" | ||
|
||
GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON | ||
URL_PATH_ARGS_SCHEMAS = {} | ||
HANDLER_ARGS_SCHEMAS = { | ||
'GET': { | ||
'comma_separated_exp_ids': { | ||
'schema': { | ||
'type': 'basestring' | ||
} | ||
} | ||
}, | ||
'PUT': { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @vojtechjelinek Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yes, use |
||
'mastery_change_per_skill': { | ||
'schema': { | ||
'type': 'object_dict', | ||
'validation_method': ( | ||
domain_objects_validator.validate_params_dict) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this schema used? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that makes sense, you should properly validate all the files of this dictionary. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the structure but I'm very confused on how to validate it under the current schema definition. @vojtechjelinek PTAL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, then you might need to write a validator that will take a dict where keys need to have skill ID format and values follow some given format. |
||
} | ||
} | ||
} | ||
} | ||
|
||
@acl_decorators.can_access_learner_dashboard | ||
def get(self): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refactor this to use
JsonEncodedInString
see other places to understand how it works.