Skip to content

Conversation

@kokokuo
Copy link
Contributor

@kokokuo kokokuo commented Jun 9, 2022

Description

This PR provides ValidatorLoader to load the validator ( implementing IValidator ) according to the pass name, like below

const folderPath = "your user-defined custom validator folder";
const validatorName = 'uuid';
const validatorLoader = new ValidatorLoader(folderPath);
const validator = await validatorLoader.load(validatorName);

validator.validateSchema(...)
validator.validateData(...)

How To Test / Expected Results

For the test result, please see the below test cases that passed the unit test:
image

Commit Message

  • c1f2ca5 - feat(core, serve): add validator loader to load validator according to name.
    • add ValidatorLoader to get the validator according to load validator by name.
    • refactor to export default for DataTypeValidator, IntegerTypeValidator, UUIDTypeValidator, StringTypeValidator.
    • refactor RequestValidator to validate data by using ValidatorLoader.
    • update related test cases in core and serve package.

@kokokuo kokokuo requested review from oscar60310 and wwwy3y3 June 9, 2022 09:56
@kokokuo kokokuo self-assigned this Jun 9, 2022
@kokokuo kokokuo force-pushed the feature/pagination-stragtegy branch from 59b8b30 to faf6f08 Compare June 14, 2022 02:56
@kokokuo kokokuo force-pushed the feature/validator-loader branch from 63ab23f to c1f2ca5 Compare June 14, 2022 03:11
@kokokuo kokokuo force-pushed the feature/pagination-stragtegy branch from faf6f08 to c75d204 Compare June 16, 2022 08:39
Copy link
Contributor

@oscar60310 oscar60310 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kokokuo kokokuo force-pushed the feature/pagination-stragtegy branch 4 times, most recently from 3d5a65e to 1c16da8 Compare June 16, 2022 10:12
@kokokuo kokokuo force-pushed the feature/validator-loader branch from c1f2ca5 to 6c4594a Compare June 16, 2022 10:30
@kokokuo kokokuo force-pushed the feature/pagination-stragtegy branch 2 times, most recently from b51e0c8 to 7dabe61 Compare June 20, 2022 04:09
@kokokuo kokokuo force-pushed the feature/validator-loader branch from 6c4594a to 49029d1 Compare June 20, 2022 06:07
@kokokuo kokokuo force-pushed the feature/pagination-stragtegy branch from 7dabe61 to f9cec9b Compare July 4, 2022 02:17
Base automatically changed from feature/pagination-stragtegy to feature/serve-ioc-container July 4, 2022 02:17
…ame.

- add "ValidatorLoader" to get validator according load validator by name.
- refactor to export default for "DataTypeValidator", "IntegerTypeValidator", "UUIDTypeValidator", "StringTypeValidator".
- refactor "RequestValidator" to validate data by using "ValidatorLoader"
- update related test cases in core and serve package.
@kokokuo kokokuo force-pushed the feature/validator-loader branch from 49029d1 to c50a648 Compare July 4, 2022 02:23
@kokokuo kokokuo merged commit 769f287 into feature/serve-ioc-container Jul 4, 2022
@kokokuo kokokuo deleted the feature/validator-loader branch July 4, 2022 02:23
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

Successfully merging this pull request may close these issues.

3 participants