Skip to content

feat: number with scale error messages#362

Merged
Rioskill merged 4 commits into
mainfrom
number-with-scale-validation
Jun 5, 2026
Merged

feat: number with scale error messages#362
Rioskill merged 4 commits into
mainfrom
number-with-scale-validation

Conversation

@Rioskill
Copy link
Copy Markdown
Contributor

Added validation errors regarding scale

@gravity-ui-bot
Copy link
Copy Markdown
Contributor

Preview is ready.

@gravity-ui-bot
Copy link
Copy Markdown
Contributor

Playwright Test Component is ready.

Comment thread src/lib/kit/validators/helpers.ts Outdated
};

/**
* Scales value given in defaultFactor to scaleFactor
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's delete all such comments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

d1

getArrayValidator,
getBooleanValidator,
getNumberValidator,
getNumberWithScaleValidator,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

d1

const baseSpec: StringSpec = {
type: SpecTypes.String,
validator: 'number',
validator: 'number_with_scale',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a maximum and minimum so the user can immediately see the validator's work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

d1

format?: 'float' | 'int64';
}

export const getNumberWithScaleValidator = (params: GetNumberWithScaleValidatorParams = {}) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's write a couple of tests for the validation function.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

d1

@Rioskill Rioskill force-pushed the number-with-scale-validation branch from 8144941 to f660037 Compare June 5, 2026 09:42
@Rioskill Rioskill merged commit 4bec5b7 into main Jun 5, 2026
4 checks passed
@Rioskill Rioskill deleted the number-with-scale-validation branch June 5, 2026 09:48
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