bridge-in-tech-backend icon indicating copy to clipboard operation
bridge-in-tech-backend copied to clipboard

Improvement: refactor expected_fields_validator

Open codesankalp opened this issue 3 years ago • 10 comments

Description

As a developer, I need validators to be fast, so that API response time will be less.

Mocks

https://github.com/anitab-org/bridge-in-tech-backend/blob/68d8ff9a8640cef1d3e53b2b0dd9b80e3d750fd7/app/utils/validation_utils.py#L157-L164

The two for loops can be implemented efficiently by using the python built-in function. I think there is no need for two for loops for this.

Acceptance Criteria

Update [Required]

  • [ ] Remove two for loops.
  • [ ] Use python builtin function to return the actual validation (described in docstrings of function).

Definition of Done

  • [ ] All of the required items are completed.
  • [ ] Approval by 1 mentor.

Estimation

0.5 hours

codesankalp avatar Mar 29 '21 15:03 codesankalp

@codesankalp I would like to work on this issue.

KushalBeniwal avatar Apr 02 '21 04:04 KushalBeniwal

@KushalBeniwal Have you completed the mandatory setup task #244 before claiming a coding/testing issue?

decon-harsh avatar Apr 02 '21 05:04 decon-harsh

@decon-harsh, no, I haven't. I will do that first.

KushalBeniwal avatar Apr 02 '21 05:04 KushalBeniwal

@KushalBeniwal comment once you do the setup task

devkapilbansal avatar Apr 02 '21 09:04 devkapilbansal

I am unable to follow from this step https://github.com/anitab-org/bridge-in-tech-backend/blob/develop/.github/ENV_SETUP_INSTRUCTION.md#4th-open-pgadmin4, as I am using wsl, so, I can only use the command line.

KushalBeniwal avatar Apr 02 '21 09:04 KushalBeniwal

I am unable to follow from this step https://github.com/anitab-org/bridge-in-tech-backend/blob/develop/.github/ENV_SETUP_INSTRUCTION.md#4th-open-pgadmin4, as I am using wsl, so, I can only use the command line.

Please join our zulip chat and ask your doubts there, we will be happy to help you with your Dev env setup. @KushalBeniwal

decon-harsh avatar Apr 02 '21 10:04 decon-harsh

I would like to work on this issue if is available, but I have a question. user_input and data_model are always int arrays, right?

y-martinez avatar Apr 11 '21 09:04 y-martinez

Hi @epicadk or @mtreacy002 a maybe possible solution could be to use the data structure set to compare if user_input and data_model are exact the same, however, I saw that in tests are falling, but the problem apparently is the code, so, I have a question, I need to verify that always user input fields contain only the expected fields of the data model? not more and not less right?, I have that doubt because so I think that I found an error in the code but I am not sure

y-martinez avatar Apr 12 '21 20:04 y-martinez

@y-martinez , can you please explain what you mean with

I need to verify that always user input fields contain only the expected fields of the data model? not more and not less right?, I have that doubt because so I think that I found an error in the code but I am not sure

mtreacy002 avatar Apr 27 '21 05:04 mtreacy002

@y-martinez any updates?

vj-codes avatar Aug 14 '21 20:08 vj-codes