question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor prod validators to be split into individual validators

See original GitHub issue

Refactor prod_validators.py such that there is one validator module per model module in core/storage/.

List of model categories

TODO

In progress

  • subtopic [John Jia]

Done

Steps to refactor

  • Extract all the validators related to a given model type for example activity into a new file named as <model-type>_validators.py for example activity_validators.py from prod_validators.py. Make sure you name the validators file exactly as <folder-name-in-above-list>_validators.py
  • Extract all the test related to the model type from prod_validators_test.py to <model-type>_validators_test.py.
  • Clean up the unused imports from the new validators file and existing prod validators file.
  • Clean up the unused variables from the new validators file and existing prod validators file.
  • Fix the file overview to have the correct explanation and copyright year.

Example PR: https://github.com/oppia/oppia/pull/10416 #10360

Note: For a guide on how to access Oppia’s webpages, see this.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:74 (55 by maintainers)

github_iconTop GitHub Comments

2reactions
DubeySandeepcommented, Dec 4, 2020

Hi @archi15 & @jcqli , I’ve assigned you to the feedback & suggestion part of this issue. You can start working on it. Do let us know if you have any questions. Thanks! 😃

1reaction
vojtechjelinekcommented, Feb 9, 2021

@Koushikk-24 Could you please first complete your work on subtopic?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Improving your validation code — a refactoring exercise
Today we're going to talk about validation. Most people have some concept where they validate an entity object before it is saved to...
Read more >
How to implement validation in a separate file using ...
I am trying to use express-validator to validate the req.body before sending a post request to insert data to postgres. I have a...
Read more >
Split up UpdateValidator per each state-transitions, & Tendermint ...
Split off from #2312 (comment) into a separate issue. Once we move all validator state changes from UpdateValidator, called on many different transactions, ......
Read more >
Replacing Throwing Exceptions with Notification in ...
Splitting the original method allows me to separate the validation check from the decision about how to respond to failure.
Read more >
Advanced Topic - Refactoring
As with user stories, splitting refactors is important, as it helps sustain better development flow. Table 1 provides some useful methods for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found