Rest.li is a REST+JSON framework for building robust, scalable service architectures using dynamic discovery and simple asynchronous APIs.

Overview

Rest.li is an open source REST framework for building robust, scalable RESTful architectures using type-safe bindings and asynchronous, non-blocking IO. Rest.li fills a niche for applying RESTful principles at scale with an end-to-end developer workflow for building REST APIs, which promotes clean REST practices, uniform interface design and consistent data modeling.

Source | Documentation | Discussion Group

Features

  • End-to-end framework for building RESTful APIs
  • Approachable APIs for writing non-blocking client and server code using ParSeq
  • Type-safe development using generated data and client bindings
  • JAX-RS inspired annotation driven server side resource development
  • Engineered and battle tested for high scalability and high availability
  • Optional Dynamic Discovery subsystem adds client side load balancing and fault tolerance
  • Backward compatibility checking to ensure all API changes are safe
  • Support for batch operations, partial updates and projections
  • Web UI for browsing and searching a catalog of rest.li APIs.

Website

https://rest.li

Documentation

See our website for full documentation and examples.

Community

Quickstart Guides and Examples

Comments
  • Schema compatibility rule for removing optional fields is inconsistent with other rules

    Schema compatibility rule for removing optional fields is inconsistent with other rules

    In CompatibilityChecker the removing an optional field is not considered an error. As a result it is not considered an error to remove an optional field and then add a new optional field with the same field name as the field just removed, but with a different type. This is clearly inconsistent with the rule that it is a compatibility error to change the type of field.

    Consider this case:

    • An optional field, let's call it 'title' of type string exists in a record schema.
    • Writers exist that produce data with "title", and readers exist that expect it to be of type string when present.
    • The optional field is removed from the schema. This is not considered an error according to CompatibilityChecker.
    • A new optional field is added to the schema, also called "title", but of type Title (a record type). This also is not considered an error according to CompatibilityChecker.

    It is now possible to have writers producing either a string or a record for the 'title' field. It is also possible to have readers expecting either a string or a record for the field. They are clearly not compatible with one another.

    I believe the correct fix it to make removing optional fields a compatibility error.

    opened by jpbetz 20
  • Error building restli-example-client

    Error building restli-example-client

    When I run gradle startExampleBasicClient command I get this build error:

    Execution failed for task ':restli-example-api:generateMainGeneratedRestRestClient'.
    > 1,1: "com.linkedin.restli.example.AlbumEntry" cannot be resolved.
    

    More complete build log:

    :restli-example-api:generateMainGeneratedRestRestClient
    Add interface file: D:\Projects\Research\rest.li\restli-example-api\src\main\idl\com.linkedin.restli.example.photos.albumEntry.restspec.json
    Add interface file: D:\Projects\Research\rest.li\restli-example-api\src\main\idl\com.linkedin.restli.example.photos.albums.restspec.json
    Add interface file: D:\Projects\Research\rest.li\restli-example-api\src\main\idl\com.linkedin.restli.example.photos.photos.restspec.json
    Generating rest client source files for: com.linkedin.restli.example.photos.albumEntry.restspec.json
    Destination directory: D:\Projects\Research\rest.li\restli-example-api\src\mainGeneratedRest\java
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:/D:/Projects/Java/gradle-1.7/lib/logback-classic-1.0.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:/C:/Users/Oleg/.gradle/caches/artifacts-26/filestore/org.slf4j/slf4j-log4j12/1.6.2/jar/7dd950c7eeb3004a91720ba8782aa0ded9037110/slf4j-log4j12-1.6.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
    SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
    :restli-example-api:generateMainGeneratedRestRestClient FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':restli-example-api:generateMainGeneratedRestRestClient'.
    > 1,1: "com.linkedin.restli.example.AlbumEntry" cannot be resolved.
    
    opened by extesy 20
  • Add validation mode for trimming and disallowing unrecognized fields

    Add validation mode for trimming and disallowing unrecognized fields

    This gives developers the option run the validator in a mode that disallows or filters out unrecognized fields when needed. For most use cases ignoring unrecognized fields for backward compatibility reasons. But there are a couple system boundaries where these approaches have been found useful.

    Note that I've included a specialized version of com.linkedin.data.it.Remover.ToRemove called ToTrim. Alternatively, could modified and then exposed some of the currently private functionality from Remover, but that would have resulted in a public API where developers could directly accumulate Remover.ToRemove objects, which is risky because if the order of those objects is not correct, the wrong elements can be removed from arrays. Also, ToTrim needs to track the paths of the elements it visits for validation message purposes.

    Questions for reviewers:

    • Does the naming look reasonable for the new Enum values? "TRIM" could alternatively have been named "FILTER".
    • Did I handle fixup correctly here?
    opened by jpbetz 16
  • fix security issues due to transitive dependency icu4j

    fix security issues due to transitive dependency icu4j

    These dependencies are brought in when using latest release of rest.li

    \--- org.antlr:antlr4:4.7.2
         +--- org.antlr:antlr4-runtime:4.7.2
         +--- org.antlr:antlr-runtime:3.5.2
         +--- org.antlr:ST4:4.1
         |    \--- org.antlr:antlr-runtime:3.5.2
         +--- org.abego.treelayout:org.abego.treelayout.core:1.0.3
         +--- org.glassfish:javax.json:1.0.4
         \--- com.ibm.icu:icu4j:61.1
    

    OWASP scanner on a sample project shows these vulnerabilities

    image

    Upgrading to latest 4.10.1 we get these

    \--- org.antlr:antlr4:4.10.1
         +--- org.antlr:antlr4-runtime:4.10.1
         +--- org.antlr:antlr-runtime:3.5.3
         +--- org.antlr:ST4:4.3.3
         |    \--- org.antlr:antlr-runtime:3.5.2 -> 3.5.3
         +--- org.abego.treelayout:org.abego.treelayout.core:1.0.3
         +--- org.glassfish:javax.json:1.0.4
         \--- com.ibm.icu:icu4j:69.1
    

    After update 0 CVEs

    image

    Ref

    • https://plugins.gradle.org/plugin/org.owasp.dependencycheck
    • https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/index.html
    opened by anshbansal 9
  • Fix non-deterministic issue for annotations in the generated data template code by using right schema location for typeref class template

    Fix non-deterministic issue for annotations in the generated data template code by using right schema location for typeref class template

    When rest.li process schema files to generate data template java code, the order of the input source file will cause the change in the annotation of the generated java class. For example: When a PDL or PDSC file A contains a data schema definition in B, and B is a typeref, when the input is in order [A, B], the generated B's class annotation comment will have a different class name compare to the two file in order [B, A] In depth, this is caused by parsing result's _schemaAndLocations entry was populated in different order when parsing is processed.

    opened by BrianPin 9
  • Rest.li Client - issue with building a request

    Rest.li Client - issue with building a request

    Hi Rest.li team, We trying to build 2 servers. One of them (Server A) need to send a request to the other (Server B).

    This is our structure: root project: "apis"

    • Contains the serves api (pdsc + the generated java class). for each server there is a separate module.
    |- build.gradle
    |- settings.gradle
    |
    |- serverA-api/build.gradle
    |- serverA-api/src/main/pegasus/net/servername/api/*.pdsc
    |- serverA-api/src/mainGeneratedDataTemplate/java/.../*.java
    |
    |- serverB-api/build.gradle
    |- serverB-api/src/main/pegasus/net/servername/api/*.pdsc
    |- serverB-api/src/mainGeneratedDataTemplate/java/.../*.java
    

    root project: "server-A"

    • Contains the "serverA-api" as a library and Implemented the api use cases.

    root project: "server-B"

    • Contains the "serverA-api" as a library - because we want to make a requests to server A.
    • Contains the "serverB-api" as a library and implemented the api use cases.

    While implementing the servers api use cases everything works well, but with implementing the rest client we got troubles... We are a bit confused with how to make a restClient requests on our current structure from server A to server B.

    do we have to create a request builder class? - if yes, how? The docs for this part are a bit confusing, what is the "product_spec.json"? https://github.com/linkedin/rest.li/wiki/Rest.li-User-Guide#depending-on-data-templates

    BTW,

    is the Web UI dead? it doesn't work - also the "restli-apihub-0.0.2.zip" download link broken. https://github.com/linkedin/rest.li-api-hub

    Thank you

    opened by loloMui 9
  • RequiredFieldNotPresentException should not result in a 500 error response

    RequiredFieldNotPresentException should not result in a 500 error response

    Passing an entity with missing required files causes a RequiredFieldNotPresentException, which in turn is wrapped by a RestLiServiceException and the service returns a 500 internal server error response.

    Since this is not a server but a client error, the status code should be 400 Bad Request.

    opened by kelihlodversson 9
  • Add a Spotbug plugin that detect and prevent use of avro1.4 and avro1.6 API

    Add a Spotbug plugin that detect and prevent use of avro1.4 and avro1.6 API

    This plugin can prevent user from using of old API before we release the new major version that completely get rid of legacy Avro versions (1.4 & 1.6)

    After all migration is finished, we might or might not need to remove it. (It should be OK to remove it)

    opened by junchuanwang 8
  • Remove deprecated V1 request builders

    Remove deprecated V1 request builders

    This is a backwards incompatible change that aims to remove the V1 request builders and associated APIs. These should all have replacements:

    1. MyResourceBuilders => MyResourceRequestBuilders
    2. MyResourceMethodBuilder => MyResourceMethodRequestBuilder
    3. BatchCreateRequest => BatchCreateIdRequest
    4. CreateRequest => CreateIdRequest
    5. CreateResponse => IdResponse
    6. BatchGetRequest / BatchGetKVRequest => BatchGetEntityRequest
    7. Response#getId => IdResponse#getEntity

    There's no urgency to merge and push this out, but keeping this up to date with the code base will require some work, so I am hoping to merge this some time this quarter and include it as part of the next major version.

    backward-incompatible v31 
    opened by tjni 8
  • Improve support for alternate schema parsers and generator target languages.

    Improve support for alternate schema parsers and generator target languages.

    This primarily cleans up DataSchemaParser to better support alternate generator target languages as well as allow for alternate schema parsers.

    This is primarily for Courier (coursera.github.io/courier) but is general enough to be useful to anyone extending pegasus.

    Courier supports multiple target languages (Swift, Scala, Java for Android) and also has it's own custom file format for authoring pegasus schemas, and would benefit significantly from having these extension points.

    Separate from this pull-request I'd like to discuss merging the custom schema language used by Courier into Pegasus, but regardless what we decide on that topic, this seems generally useful.

    Testing:

    ./gradlew test
    ...
    SUCCESS
    
    opened by jpbetz 8
  • Add an IntelliJ plugin for PDL.

    Add an IntelliJ plugin for PDL.

    This code exists internally at LI. I've done the minimal amount of work to copy it here to open source and get it building.

    Note I did need to disable Werror for this one project. We can clean it up later.

    opened by jplaisted 7
  • what plugins fixed for .pdl file

    what plugins fixed for .pdl file

    question: hello. I would like to know where there has plugins fixed for resolve the .pdl file ?

    ide: intellij idea / microsoft visual studio code.

    thanks.

    opened by jkl0898 0
  • cannot run quickstart example

    cannot run quickstart example

    example url: https://github.com/linkedin/rest.li/tree/master/examples/quickstart

    exec cmd: gradle publishRestliIdl

    error log:

    Task :api:generateDataTemplate FAILED There are 1 data schema input files. Using input root folder: D:\code\tool\linkedin\rest.li\examples\quickstart\api\src\main\pegasus

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':api:generateDataTemplate'.

    'other' has different root

    • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

    • Get more help at https://help.gradle.org

    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.6/userguide/command_line_interface.html#sec:command_line_warnings

    BUILD FAILED in 15s 1 actionable task: 1 executed

    env: os: windows10 gradle version: 6.6

    opened by jkl0898 0
  • Migrate rest.li to Gradle 5.6.4

    Migrate rest.li to Gradle 5.6.4

    This PR drops the support of all Gradle versions below 5.6.4. It is a foundation to improve the plugin's support to Gradle 7 and above. It is usually considered a good practice for a Gradle plugin to support only two major versions at a time.

    Testing done

    • local build ok
    opened by bzzzzzz 0
  • keys starting with numeric string are throwing the following exception while generating PDL schema

    keys starting with numeric string are throwing the following exception while generating PDL schema

    Hi Team, We use the maven repo https://mvnrepository.com/artifact/com.linkedin.pegasus/data/27.7.18.

    Keys starting with numeric string are throwing the following exception while generating PDL schema.

    Exception in thread "main" java.lang.IllegalArgumentException: 1,93: "00100030" is an invalid field name.

    at com.linkedin.data.template.DataTemplateUtil.parseSchema(DataTemplateUtil.java:313)
    at com.linkedin.data.template.DataTemplateUtil.parseSchema(DataTemplateUtil.java:291)
    

    Details: We are trying to convert 'dicom' json data/schema to 'PDL'. 'dicom' data has lot of keys(string) that start with a numeral say "0020000D"

    eg: { "0020000D": { "vr": "UI", "Value": [ "1.2.392.200036.9116.2.2.2.1762893313.1029997326.945873" ] } } Note: The complete dicom data file can be found https://dicom.nema.org/dicom/2013/output/chtml/part18/sect_F.4.html

    But the "linkedin pegasus data" library does not allow keys which start with a number, eg "0020000D", while creating PDL schema.

    Please let us know if you need more details

    opened by satsrini 2
Releases(v15.0.3)
Owner
LinkedIn
LinkedIn
JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.

Greetings, Java Hipster! Full documentation and information is available on our website at https://www.jhipster.tech/ Please read our guidelines befor

JHipster 20.2k Jan 5, 2023
Android service daemon ,keep background service alive

安卓后台保活2021新姿势 适配华为大部分系列手机,vivo,OPPO 部分机型,小米的不支持,可见小米在对抗后台自保上做得最好 本项目原本是给某个公司合作开发的,最后给了对方SDK之后由于付款问题闹得很郁闷,想着这个代码拿在自己手上也没用,就发出来给大家参考参考。目前分析的结果来看,这个是全网目前

null 65 Nov 29, 2022
A damn simple library for building production-ready RESTful web services.

Dropwizard Dropwizard is a sneaky way of making fast Java web applications. It's a little bit of opinionated glue code which bangs together a set of l

Dropwizard 8.3k Jan 5, 2023
Leading REST API framework for Java

Restlet Framework The leading REST API framework for Java Thanks to Restlet Framework's powerful routing and filtering capabilities, unified client an

Restlet Framework 633 Dec 18, 2022
Rapidoid - Extremely Fast, Simple and Powerful Java Web Framework and HTTP Server!

Rapidoid - Simple. Powerful. Secure. Fast! Rapidoid is an extremely fast HTTP server and modern Java web framework / application container, with a str

null 1.6k Dec 30, 2022
Simple JSP Servlets REST api.

Simple JSP Servlets REST api.

MisterFunny01 3 May 9, 2021
Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API

Swagger Core NOTE: If you're looking for Swagger Core 1.5.X and OpenAPI 2.0, please refer to 1.5 branch. NOTE: Since version 2.1.7 Swagger Core suppor

Swagger 7.1k Jan 5, 2023
Microserver is a Java 8 native, zero configuration, standards based, battle hardened library to run Java Rest Microservices via a standard Java main class. Supporting pure Microservice or Micro-monolith styles.

Microserver A convenient modular engine for Microservices. Microserver plugins offer seamless integration with Spring (core), Jersey, Guava, Tomcat, G

AOL 936 Dec 19, 2022
Spring HATEOAS - Library to support implementing representations for hyper-text driven REST web services.

Spring HATEOAS This project provides some APIs to ease creating REST representations that follow the HATEOAS principle when working with Spring and es

Spring 996 Dec 28, 2022
Spring HATEOAS - Library to support implementing representations for hyper-text driven REST web services.

Spring HATEOAS This project provides some APIs to ease creating REST representations that follow the HATEOAS principle when working with Spring and es

Spring 920 Mar 8, 2021
RestAhead - compile time generated REST client

RestAhead - compile time generated REST client This project draws inspiration from projects such as Retrofit and Feign, but with a twist: your service

Žan Skamljič 13 Dec 24, 2022
A simple banking system written in Java used to teach object-oriented programming and best coding practices.

didactic-bank-application A simple banking system written in Java used to teach object-oriented programming and best coding practices. It is a three-l

Ingrid Nunes 32 Aug 28, 2022
A simple http wrapper

HTTP Wrapper A Java 8 HTTP Wrapper Lib to deserialize the response! Explore the docs » Examples · Report Bug · Request Feature Getting Started This is

Diego Cardenas 13 Jul 22, 2021
A simple API wrapper for discords.com (alias botsfordiscord.com) written in Java.

Discords.com / BotsForDiscord.com Java Library A simple API wrapper for discords.com (alias botsfordiscord.com) written in Java 8. Installation This w

Dorian 3 Aug 6, 2021
Create Queries using only POJO classes.

Fluent Query Create Queries, Inserts, Updates e Deletes using only POJO classes. Features Configuration over code: independence business code of the i

naskarlab 11 Sep 1, 2022
A type-safe HTTP client for Android and the JVM

Retrofit A type-safe HTTP client for Android and Java. For more information please see the website. Download Download the latest JAR or grab from Mave

Square 41k Jan 5, 2023
Better compatibility, compatible with konas, future, pyro and rusher.

Compatible phobos 1.9.0 compatible with pyro, future, konas and rusher. to build it yourself, use: MACOS/LINUX: ./gradlew setupDecompWorkspace ./gradl

Hurb 15 Dec 2, 2022
This repository contains HttpUrlConnection and Volley based application example

This repository contains HttpUrlConnection and Volley based application example. In this you will find implementation of both ways to consume API. This repository show examples to send receive the data in both cases.

Zeeshan 3 Jan 15, 2022