Skip to content

Commit

Permalink
readme에 설명 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticPrg committed Aug 19, 2020
1 parent 1261121 commit a647d4e
Showing 1 changed file with 43 additions and 2 deletions.
45 changes: 43 additions & 2 deletions README.md
@@ -1,5 +1,10 @@
# everybody777 graphql schema

이 저장소에는 아래 내용을 포함합니다.

- GraphQL Schema
- Schema로부터 typescript/kotlin 타입 정의를 자동 생성하는 설정/도구

## Requirements

- NodeJS v12 이상
Expand All @@ -9,6 +14,42 @@

`yarn install`

## Usage
## 자동 생성

프로젝트 루트에서 `yarn gen` 명령어를 사용하면 `/gen` 폴더에 타입 정의하는 파일이 생성됩니다.

예를 들어 graphql schema에 아래와 같은 타입 정의가 있다고 하면

```graphql
type Tile {
order: Int!
sketchUrl: String!
}
```

typescript로는 다음과 같은 정의가 생성됩니다.

```typescript
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
};

export type Tile = {
__typename?: "Tile";
order: Scalars["Int"];
sketchUrl: Scalars["String"];
};
```

kotlin으로는 다음과 같은 정의가 생성됩니다.

`yarn gen`
```kotlin
data class Tile(
val order: Int,
val sketchUrl: String
)
```

0 comments on commit a647d4e

Please sign in to comment.