Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@dialexa/pleco-joi
Advanced tools
## Table of Contents - [Overview](#overview) - [Joi Validation Schemas](#joi-validation-schemas) * [Provided Exports](#provided-exports) + [Usage](#usage) + [Usage](#usage-1) - [Resources](#resources)
The Joi validation schemas provide additional protection around what the user inputs.
filterQuerySchema
: a function that returns the schema pertaining to the IFilterQuery
typescript type or the FilterQuery_*
GraphQL type.
The rules for filters are:
import { filterQuerySchema } from '@dialexa/pleco-joi';
const vehicleFilterSchemaKeys = {
AND: Joi.array().items(Joi.lazy(() => vehicleFilterSchema)),
OR: Joi.array().items(Joi.lazy(() => vehicleFilterSchema)),
make: filterQuerySchema('String', Joi.string()),
model: filterQuerySchema('String', Joi.string()),
// We can define any Joi schema
numberOfUsers: filterQuerySchema('Int', Joi.number().integer().min(0)),
highwayMPG: filterQuerySchema('Int', Joi.number().integer().min(0)),
cityMPG: filterQuerySchema('Int', Joi.number().integer().min(0)),
userSurveyRating: filterQUerySchema('Float', Joi.number().min(0).max(100)),
};
const vehicleFilterSchema = Joi.object().keys(vehicleFilterSchemaKeys).oxor(Object.keys(vehicleFilterSchemaKeys));
sortDirectionSchema
: validates that the argument to a sort operation is 'ASC' or 'DESC' (case insensitive).
Validating against this schema will also automatically convert the input to uppercase.
import { sortDirectionSchema } from '@dialexa/pleco-joi';
const vehicleSortSchemaKeys = {
numberOfUsers: sortDirectionSchema,
userSurveyRating: sortDirectionSchema,
};
const vehicleSortSchema = Joi.object().keys(vehicleSortSchemaKeys).oxor(Object.keys(vehicleSortSchemaKeys));
limitOffsetPageSchema
: validates that an object containing optional limit
and offset
are non-negative integers
FAQs
# Pleco Joi
The npm package @dialexa/pleco-joi receives a total of 0 weekly downloads. As such, @dialexa/pleco-joi popularity was classified as not popular.
We found that @dialexa/pleco-joi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.