Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Cowboy-coder/yipp
An api tool for building rest apis, heavily inspired by GQL syntax.
https://github.com/Cowboy-coder/yipp
api schema
Last synced: about 2 months ago
JSON representation
An api tool for building rest apis, heavily inspired by GQL syntax.
- Host: GitHub
- URL: https://github.com/Cowboy-coder/yipp
- Owner: Cowboy-coder
- License: mit
- Created: 2021-11-29T09:39:45.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-19T11:42:31.000Z (almost 3 years ago)
- Last Synced: 2024-04-16T11:12:51.562Z (5 months ago)
- Topics: api, schema
- Language: TypeScript
- Homepage: https://www.yipp.dev
- Size: 266 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
yipp
====Use a GQL-inspired syntax to build a schema-first driven REST API.
```graphql
# schema.yipptype FieldError {
field: String!
message: String!
}type Error {
message: String!
fields: [FieldError!]!
}enum UserType {
admin
user
}
login: POST /login {
body: {
username: String!
password: String!
}
200: {
body: {
token: String!
}
}
400: {
body: Error
}
}getUser: GET /users/:id(Int) {
headers: {
authorization: String!
}
200: {
body: {
id: Int!
username: String!
type: UserType!
}
}400: {
body: Error
}
}
```### Install and usage
```
npm install -g yipp
yipp axios-client output.ts schema.yipp
```### CLI
Can be used to generate different clients, servers, etc.
Example of generators using [this schema](https://github.com/Cowboy-coder/yipp/tree/master/src/examples/schemas/):
- [`fastify-plugin`](https://github.com/Cowboy-coder/yipp/tree/master/src/examples/fastify/routes.ts) - Fastify Plugin
- [`axios-client`](https://github.com/Cowboy-coder/yipp/tree/master/src/examples/axios-client/generated.ts) - HTTP Client using Axios```
Usage: yipp [options]generate
Arguments:
type (choices: "fastify-plugin", "axios-client")
output-file generated typescript file
input-file One or more api schema files. Will be merged into one schema if several files.Options:
-w --watch watch for changes (default: false)
-h, --help display help for command
```🐄