All Projects → pathikrit → Metarest

pathikrit / Metarest

Scala macros to generate RESTful Models

Programming Languages

scala
5932 projects

Labels

Projects that are alternatives of or similar to Metarest

Paypal Php Sdk
PHP SDK for PayPal RESTful APIs
Stars: ✭ 2,100 (+988.08%)
Mutual labels:  rest-api
Mcloud
基于Spring Cloud,实现微服务中常用的基础模块,包括 OAuth2 认证服务,统一注册中心,系统监控中心, 统一配置中心,API网关以及熔断器
Stars: ✭ 185 (-4.15%)
Mutual labels:  rest-api
Api
API that uncovers the technologies used on websites and generates thumbnail from screenshot of website
Stars: ✭ 189 (-2.07%)
Mutual labels:  rest-api
Bmw Yolov4 Inference Api Cpu
This is a repository for an nocode object detection inference API using the Yolov4 and Yolov3 Opencv.
Stars: ✭ 180 (-6.74%)
Mutual labels:  rest-api
Lumen Microservice
Lumen on Docker - Skeleton project with Nginx, MySQL & PHP 7 | Aws ECS, Google Kubernates, Azure Container Engine
Stars: ✭ 183 (-5.18%)
Mutual labels:  rest-api
Swagger Codegen
swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
Stars: ✭ 13,859 (+7080.83%)
Mutual labels:  rest-api
Mockinizer
An okhttp / retrofit api call mocking library
Stars: ✭ 176 (-8.81%)
Mutual labels:  rest-api
Frappe
Low code web framework for real world applications, in Python and Javascript
Stars: ✭ 3,349 (+1635.23%)
Mutual labels:  rest-api
Apicheck
The DevSecOps toolset for REST APIs
Stars: ✭ 184 (-4.66%)
Mutual labels:  rest-api
Tipe
🎉 Next Generation API-first CMS for developers. Generate an API-first CMS from a GraphQL schema with offline prototyping and an inline editor
Stars: ✭ 2,157 (+1017.62%)
Mutual labels:  rest-api
Storefront Api
Storefront GraphQL API Gateway. Modular architecture. ElasticSearch included. Works great with Magento1, Magento2, Spree, OpenCart, Pimcore and custom backends
Stars: ✭ 180 (-6.74%)
Mutual labels:  rest-api
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (-6.22%)
Mutual labels:  rest-api
Autoserver
Create a full-featured REST/GraphQL API from a configuration file
Stars: ✭ 188 (-2.59%)
Mutual labels:  rest-api
Proteus
Lean, mean, and incredibly fast JVM framework for web and microservice development.
Stars: ✭ 178 (-7.77%)
Mutual labels:  rest-api
Drf Yasg
Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
Stars: ✭ 2,523 (+1207.25%)
Mutual labels:  rest-api
Vue Material Admin
A vue material design admin template
Stars: ✭ 2,170 (+1024.35%)
Mutual labels:  rest-api
Piladb
Lightweight RESTful database engine based on stack data structures
Stars: ✭ 184 (-4.66%)
Mutual labels:  rest-api
Node Rem
Node REM - NodeJS Rest Express MongoDB and more: typescript, passport, JWT, socket.io, HTTPS, HTTP2, async/await, nodemailer, templates, pagination, docker, etc. Live Demo: https://node-rem-ngduc.vercel.app
Stars: ✭ 192 (-0.52%)
Mutual labels:  rest-api
Rql
Resource Query Language for REST
Stars: ✭ 190 (-1.55%)
Mutual labels:  rest-api
Blynk Server
Blynk is an Internet of Things Platform aimed to simplify building mobile and web applications for the Internet of Things. Easily connect 400+ hardware models like Arduino, ESP8266, ESP32, Raspberry Pi and similar MCUs and drag-n-drop IOT mobile apps for iOS and Android in 5 minutes
Stars: ✭ 8 (-95.85%)
Mutual labels:  rest-api

MetaRest CircleCI Download

Use Scala macros to generate your RESTy models

Let's say you have the following User model in your business layer:

case class User(id: Int, name: String, email: String, registeredOn: DateTime)

But, now you want to create well-formed models to describe the requests/responses of your HTTP REST APIs:

// Response to GET /users/$id (Retrieve an existing user)
case class UserGet(id: Int, name: String, email: String)

// Request body of POST /users (Create a new user)
case class UserPost(name: String, email: String)

//Request body of PATCH /users/$id (Edit name of an existing user)
case class UserPatch(name: Option[String])

That is a lot of boilerplate! Keeping all these request models in sync with your business model and/or adding/removing fields quickly becomes tedious for more complicated models. With MetaRest, all you need to do is:

import com.github.pathikrit.metarest._

@Resource case class User(
  @get               id            : Int,
  @get @post @patch  name          : String,
  @get @post         email         : String,
                     registeredOn  : DateTime
)

The above annotated code would generate code essentially looking like this:

object User {
  case class Get(id: Int, name: String, email: String)
  case class Post(name: String, email: String)
  case class Patch(name: Option[String])        // Note: all fields in a PATCH are optional
}

Now, you can have a well defined CRUD interface for your API:

trait UserRepo {
  def getAll: List[User.Get]
  def get(id: Int): User.Get
  def create(request: User.Post): User.Get
  def replace(id: Int, request: User.Put): User.Get
  def update(id: Int, request: User.Patch): User.Get
  def delete(id: Int): User.Get
}

sbt

In your build.sbt, add the following entries:

resolvers += Resolver.bintrayRepo("pathikrit", "maven")

libraryDependencies += "com.github.pathikrit" %% "metarest" % "2.0.0"

addCompilerPlugin("org.scalameta" % "paradise" % "3.0.0-M8" cross CrossVersion.full)

Although this library currently only supports Scala 2.11+, older versions of this library that used to support Scala 2.10.x are available here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].