An open API service indexing awesome lists of open source software.

https://github.com/idevelopthings/go-type-schema-parser


https://github.com/idevelopthings/go-type-schema-parser

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

        

# Custom Schema Parser

A simple parser for a custom schema language, written in Go. This project is inspired by a request from a user, and the code has been generated by the OpenAI's ChatGPT language model.

The legend wrote the code which was almost 90% working, and wrote this readme. 👏

## Overview

The custom schema parser can parse schema definitions in the following format:

```
type User('users') {
id: ID!
name: string
username: string
someInt: int
someFloat: float
someBool: bool
someDate: date
someDateTime: datetime
ids: array
}
```

The parser is divided into three main components:

1. `main.go`: Contains the `main()` function and data structures to represent the schema.
2. `lexer.go`: Tokenizes the input string into a series of tokens.
3. `parser.go`: Parses the tokenized input into schema structures.

## Usage

1. Build the parser:

```bash
$ go build -o parser
```