Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

nestjs graphql schema description

@ObjectType( {description : 'My class') )
Class Person {
    @Field ( () => ID, { description : ' ID of the user' } ) 
    Id: number
}
Comment

graphql nested schema

const StaffType = new GraphQLObjectType({
    name: 'Staff',
    fields: {
      id: {type: GraphQLInt},
      name: {type: GraphQLString},
      role: {type: GraphQLString},
      address: {type: AddressType}
    }
})

const AddressType = new GraphQLObjectType({
    name: 'Address',
    fields: {
      street: {type: GraphQLString},
      town: {type: GraphQLString}
    }
})
Comment

graphql nested schema

`const MovieType = new GraphQLObjectType({
  name: 'Movie',
  fields: () => ({
    id: { type: GraphQLString },
    adult: { type: GraphQLBoolean },
    backdrop_path: { type: GraphQLString },
    belongs_to_collection: { type: BelongsToCollection },
    budget: { type: GraphQLInt },
    overview: { type: GraphQLString },
    popularity: { type: GraphQLInt },
    poster_path: { type: GraphQLString },
    production_companies: {
      type: new GraphQLList(CompaniesType)
    },
    genres: {
      type: new GraphQLList(GenreType)
    },
    release_date: { type: GraphQLString },
    tagline: { type: GraphQLString },
    title: { type: GraphQLString },
    vote_average: { type: GraphQLInt },
    vote_count: { type: GraphQLInt }
  })
});

const CompaniesType = new GraphQLObjectType({
  name: 'ProductionCompanies',
  fields: {
    id: { type: GraphQLInt },
    name: { type: GraphQLString },
    logo_path: { type: GraphQLString },
    original_country: { type: GraphQLString }
  }
});

const GenreType = new GraphQLObjectType({
  name: 'Genre',
  fields: () => ({
    id: { type: GraphQLInt },
    name: { type: GraphQLString }
  })
})

const BelongsToCollection = new GraphQLObjectType({
  name: 'BelongsToCollection',
  fields: () => ({
    id: { type: GraphQLInt },
    name: { type:  GraphQLString },
    poster_path: { type: GraphQLString },
    backdrop_path: { type: GraphQLString  } 
  })
});`
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to call ajax javascript 
Javascript :: javascript every nested array 
Javascript :: javascript check item is checkbox 
Javascript :: arrow functions basic usages in javascript 
Javascript :: fibonacci sequence array 
Javascript :: do while loop js 
Javascript :: javascript brightness filter 
Javascript :: comentar en javascript 
Javascript :: queryselector j 
Javascript :: input variable in string javascript 
Javascript :: push pop in javascript 
Javascript :: ` ` in javascript 
Javascript :: constructer 
Javascript :: take off element form end of array 
Javascript :: javascript map with arrow function 
Javascript :: javascript remove the last element from array 
Javascript :: mvc asp.net partial view from js 
Javascript :: java script removing first three indexes 
Javascript :: local time 
Javascript :: js find 
Javascript :: data table buttons 
Javascript :: objects 
Javascript :: reduce function in javascript 
Javascript :: building an array of a numbers javascript 
Javascript :: react validate 
Javascript :: javascript async await returns undefined 
Javascript :: javascript random item of array 
Javascript :: fetch not working javascript 
Javascript :: vue resources post 
Javascript :: what would (int) (Math.random()) output 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =