
Security News
Django Joins curl in Pushing Back on AI Slop Security Reports
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
graphql-validate-directive
Advanced tools
This is a directive validation library for GraphQL. Inspired by validate-directive.
Different with graphql-constraint-directive. It do validate on resolve field instead of creating new scaler.
yarn add graphql-validate-directive
or
npm i -S graphql-validate-directive
Use in the project.
import {
validateDirective,
GraphQLValidateDirectiveTypeDefs,
} from 'graphql-validate-directive'
import { makeExecutableSchema } from '@graphql-tools/schema'
const schema = makeExecutableSchema({
typeDefs: [
// ... your type definitions
GraphQLValidateDirectiveTypeDefs,
],
resolvers: {
// ...
},
})
validateDirective()(schema)
Use in schema.
# used on input field
input PostInput {
title: String! @validate(minLength: 1, maxLength: 1000)
content: String! @validate(minLength: 1, maxLength: 1000)
# used on array
tags: [String!]
@validate(minItems: 1, maxItems: 10, minLength: 1, maxLength: 100)
}
type Mutation {
createPost(input: PostInput!): Post
# used on argument
createMessage(
content: String! @validate(minLength: 1, maxLength: 200)
): Message
}
MIT Licensed.
FAQs
A GraphQL directive for input validation
The npm package graphql-validate-directive receives a total of 75 weekly downloads. As such, graphql-validate-directive popularity was classified as not popular.
We found that graphql-validate-directive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.