Skip to content

Commit

Permalink
docs(getting-started): add missing commas in sentence (MichalLytek#1268)
Browse files Browse the repository at this point in the history
Co-authored-by: Casey Siebel <[email protected]>
  • Loading branch information
currenthandle and Casey Siebel authored Jun 7, 2022
1 parent dad24a4 commit eea297e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The detailed rules for when and why we declare `returns => Recipe` functions and

## Inputs and Arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
Expand Down
21 changes: 16 additions & 5 deletions website/versioned_docs/version-0.16.0/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ To explore all powerful capabilities of TypeGraphQL, we will create a sample Gra
Let's start with the `Recipe` type, which is the foundations of our API.

## Types

We want to get equivalent of this type described in SDL:

```graphql
type Recipe {
id: ID!
Expand All @@ -21,6 +23,7 @@ type Recipe {
```

So we create the `Recipe` class with all properties and types:

```typescript
class Recipe {
id: string;
Expand All @@ -32,6 +35,7 @@ class Recipe {
```

Then we decorate the class and its properties with decorators:

```typescript
@ObjectType()
class Recipe {
Expand All @@ -51,6 +55,7 @@ class Recipe {
ingredients: string[];
}
```

The detailed rules when to use `nullable`, `array` and others are described in [fields and types docs](types-and-fields.md).

## Resolvers
Expand Down Expand Up @@ -103,7 +108,8 @@ The detailed rules when and why we declare `returns => Recipe` functions and oth

## Inputs and arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
class NewRecipeDataInput {
Expand All @@ -127,25 +133,29 @@ class RecipesArgs {
skip: number = 0;

@Field(type => Int)
@Min(1) @Max(50)
@Min(1)
@Max(50)
take: number = 25;
}

```

`@Length`, `@Min` or `@MaxArraySize` are decorators from [`class-validator`](https://github.com/typestack/class-validator) that automatically perform fields validation in TypeGraphQL.

## Building schema

The last step that we have to do is to actually build the schema from TypeGraphQL definition. We use `buildSchema` function for this:

```typescript
const schema = await buildSchema({
resolvers: [RecipeResolver]
resolvers: [RecipeResolver],
});

// ...creating express server or sth
```

Et voilà! Now we have fully working GraphQL schema!
If we print it, we would receive exactly this:

```graphql
type Recipe {
id: ID!
Expand All @@ -170,6 +180,7 @@ type Mutation {
```

## Want more?

That was only a tip of the iceberg - a very simple example with basic GraphQL types. Do you use interfaces, enums, unions and custom scalars? That's great because TypeGraphQL fully supports them too! There are also more advanced concepts like authorization checker, inheritance support or field resolvers.

If you want to see how it looks in more complicated case, you can go to the [Examples section](examples.md) where you can find e.g. how nice TypeGraphQL integrates with TypeORM.
If you want to see how it looks in more complicated case, you can go to the [Examples section](examples.md) where you can find e.g. how nice TypeGraphQL integrates with TypeORM.
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.17.0/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The detailed rules when and why we declare `returns => Recipe` functions and oth

## Inputs and arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.17.1/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The detailed rules for when and why we declare `returns => Recipe` functions and

## Inputs and Arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-0.17.2/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The detailed rules for when and why we declare `returns => Recipe` functions and

## Inputs and Arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-1.0.0/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ The detailed rules for when and why we declare `returns => Recipe` functions and

## Inputs and Arguments

Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are of course classes:
Ok, but what are `NewRecipeInput` and `RecipesArgs`? They are, of course, classes:

```typescript
@InputType()
Expand Down

0 comments on commit eea297e

Please sign in to comment.