Skip to content

Using NestJS validations with Neo4jGraphQL library #117

@gethassaan

Description

@gethassaan

Is your feature request related to a problem? Please describe.
While working on a project in nestjs using Graphql and Neo4j I have come across a problem when I need to validate the inputs for the Qureries and Mutations. However if you're following the approach described in Nestjs' documents adding these validations (using class-validator) is quite straight forward.

import { MinLength, MaxLength } from 'class-validator';

export class CreatePostInput {
  @MinLength(3)
  @MaxLength(50)
  title: string;
}

Whereas it can't be done with the suggested Schema Types approach from Neo4j (as class-validator requires class schema).

interface Production {
    title: String!
    actors: [Actor!]! @declareRelationship
}

type Movie implements Production {
    title: String!
    actors: [Actor!]! @relationship(type: "ACTED_IN", direction: IN, properties: "ActedIn")
    runtime: Int!
}

Describe the solution you'd like
I am looking for way where it's possible to add Schemas using classes so that we can take full advantage of existing futures of Nestjs and develop the applications without these constraints

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions