UNPKG

graphql-constraint-directive

Version:
51 lines (41 loc) 1.38 kB
directive @constraint(minLength: Int, maxLength: Int, startsWith: String, endsWith: String, contains: String, notContains: String, pattern: String, format: String, min: Float, max: Float, exclusiveMin: Float, exclusiveMax: Float, multipleOf: Float, minItems: Int, maxItems: Int, uniqueTypeName: String) on INPUT_FIELD_DEFINITION | FIELD_DEFINITION | ARGUMENT_DEFINITION type Query { """Query books field documented""" books( "*Constraints:*\n* Minimal value: `1`\n* Maximal value: `3`\n" size: Int " Query argument documented \n\n*Constraints:*\n* Minimal length: `1`\n" first: String ): [Book] """ Query book field documented """ book: Book addedField: String } type Book { "*Constraints:*\n* Maximal length: `10`\n" title: String "Book description already documented\n\n*Constraints:*\n* Minimal length: `10`\n* Maximal length: `50`\n" description: String authors( "Book authors argument documented\n\n*Constraints:*\n* Maximal value: `4`\n" size: Int """ Already documented *Constraints:* * Minimal length as documented: 1 """ first: String ): [String] } type Mutation { createBook(input: BookInput): Book } input BookInput { "*Constraints:*\n* Minimal value: `3`\n" title: Int! author: AuthorInput } input AuthorInput { "*Constraints:*\n* Minimal length: `2`\n" name: String! }