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

Rework evaluation attribute schema validation #441

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

denis-rossati
Copy link
Member

@denis-rossati denis-rossati commented Nov 11, 2024

Summary

This PR will make the schema validation more robust, very similar to what is done in this part of the evaluation-service

It also increases the maximum amount of characters

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@denis-rossati denis-rossati self-assigned this Nov 11, 2024
Copy link

pkg-pr-new bot commented Nov 11, 2024

Open in Stackblitz

npm i https://pkg.pr.new/@croct/sdk@441

commit: a84b435

@denis-rossati denis-rossati added the bug Something isn't working label Nov 11, 2024
new StringType({maxLength: 255}),
];

const getNestedSchemas = (): [...PrimitiveSchemas, ...TypeSchema[]] => [
Copy link
Member

Choose a reason for hiding this comment

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

You don't need this nested function. Is there any reason not to replicate the evaluation service's function?

Copy link
Member Author

@denis-rossati denis-rossati Nov 13, 2024

Choose a reason for hiding this comment

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

This is a replica, just a little more verbose because in PHP we can type the array and the associative array at once, here we need to type the array and the object separately

There is one difference, though, that I left out on purpose: the evaluation service's validation allows attributes as arrays like {attributes: [1, 2, 3]}, but here we'll only allow actual objects

src/schema/evaluatorSchemas.ts Outdated Show resolved Hide resolved
@marcospassos marcospassos merged commit 83fad07 into master Nov 14, 2024
@marcospassos marcospassos deleted the add-char-validation branch November 14, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a maxLength string validation to the SDK
2 participants