Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
/elidePublic
forked fromyahoo/elide

Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.

License

NotificationsYou must be signed in to change notification settings

miks/elide

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Opinionated APIs for web & mobile applications.

Elide Logo

DiscordBuild StatusMaven CentralCoverage StatusCode Quality: JavaTotal AlertsMentioned in Awesome JavaMentioned in Awesome GraphQL

Read this in other languages:中文.

Table of Contents

Background

Elide is a Java library that lets you setup model drivenGraphQL orJSON API web service with minimal effort. Elide supports two variants of APIs:

  1. A CRUD (Create, Read, Update, Delete) API for reading and manipulating models.
  2. An analytic API for aggregating measures over zero or more model attributes.

Elide supports a number of features:

Security Comes Standard

Control access to fields and entities through a declarative, intuitive permission syntax.

Mobile Friendly APIs

JSON-API & GraphQL lets developers fetch entire object graphs in a single round trip. Only requested elements of the data model are returned.Our opinionated approach for mutations addresses common application scenarios:

  • Create a new object and add it to an existing collection in the same operation.
  • Create a set of related, composite objects (a subgraph) and connect it to an existing, persisted graph.
  • Differentiate between deleting an object vs disassociating an object from a relationship (but not deleting it).
  • Change the composition of a relationship to something different.
  • Reference a newly created object inside other mutation operations.

Filtering, sorting, pagination, and text search are supported out of the box.

Atomicity For Complex Writes

Elide supports multiple data model mutations in a single request in either JSON-API or GraphQL. Create objects, add them to relationships, modify or delete together in a single atomic request.

Analytic Query Support

Elide supports analytic queries against models crafted with its powerful semantic layer. Elide APIs work natively withYavin to visualize, explore, and report on your data.

Schema Introspection

Explore, understand, and compose queries against your Elide API through generated Swagger documentation or GraphQL schema.

Customize

Customize the behavior of data model operations with computed attributes, data validation annotations, and request lifecycle hooks.

Storage Agnostic

Elide is agnostic to your particular persistence strategy. Use an ORM or provide your own implementation of a data store.

Documentation

More information about Elide can be found atelide.io.

Install

To try out an Elide example service, check out thisSpring boot example project.

Alternatively, useelide-standalone which allows you to quickly setup a local instance of Elide running inside an embedded Jetty application.

Usage

For CRUD APIs

The simplest way to use Elide is by leveragingJPA to map your Elide models to persistence:

The models should represent the domain model of your web service:

@EntitypublicclassBook {@IdprivateIntegerid;privateStringtitle;@ManyToMany(mappedBy ="books")privateSet<Author>authors;}

Add Elide annotations to both expose your models through the web service and define security policies for access:

@Entity@Include(rootLevel =true)@ReadPermission("Everyone")@CreatePermission("Admin OR Publisher")@DeletePermission("None")@UpdatePermission("None")publicclassBook {@IdprivateIntegerid;@UpdatePermission("Admin OR Publisher")privateStringtitle;@ManyToMany(mappedBy ="books")privateSet<Author>authors;}

Add Lifecycle hooks to your models to embed custom business logic that execute inline with CRUD operations through the web service:

@Entity@Include(rootLevel =true)@ReadPermission("Everyone")@CreatePermission("Admin OR Publisher")@DeletePermission("None")@UpdatePermission("None")@LifeCycleHookBinding(operation =UPDATE,hook =BookCreationHook.class,phase =PRECOMMIT)publicclassBook {@IdprivateIntegerid;@UpdatePermission("Admin OR Publisher")privateStringtitle;@ManyToMany(mappedBy ="books")privateSet<Author>authors;}publicclassBookCreationHookimplementsLifeCycleHook<Book> {@Overridepublicvoidexecute(LifeCycleHookBinding.Operationoperation,LifeCycleHookBinding.TransactionPhasephase,Bookbook,RequestScoperequestScope,Optional<ChangeSpec>changes) {//Do something    }}

Map expressions to security functions or predicates that get pushed to the persistence layer:

@SecurityCheck("Admin")publicstaticclassIsAdminUserextendsUserCheck {@Overridepublicbooleanok(Useruser) {returnisUserInRole(user,UserRole.admin);        }    }

To expose and query these models, follow the steps documented inthe getting started guide.

For example API calls, look at:

  1. JSON-API
  2. GraphQL

For Analytic APIs

Analytic models including tables, measures, dimensions, and joins can be created either as POJOs or with a friendly HJSON configuration language:

{  tables: [    {      name: Orders      table: order_details      measures: [        {          name: orderTotal          type: DECIMAL          definition: 'SUM({{$order_total}})'        }      ]      dimensions: [        {          name: orderId          type: TEXT          definition: '{{$order_id}}'        }      ]    }  ]}

More information on configuring or querying analytic models can be foundhere.

Security

Security is documented in depthhere.

Contribute

Please refer tothe contributing.md file for information about how to get involved. We welcome issues, questions, and pull requests.

If you are contributing to Elide using an IDE, such as IntelliJ, make sure to install theLombok plugin.

Community chat is now ondiscord. Join by clickinghere.Legacy discussion is archived onspectrum.

License

This project is licensed under the terms of theApache 2.0 open source license.Please refer toLICENSE for the full terms.

Articles

Intro to Elide video

Intro to Elide

Create a JSON API REST Service With Spring Boot and Elide

Custom Security With a Spring Boot/Elide Json API Server

Logging Into a Spring Boot/Elide JSON API Server

Securing a JSON API REST Service With Spring Boot and Elide

Creating Entities in a Spring Boot/Elide JSON API Server

Updating and Deleting with a Spring Boot/Elide JSON API Server

About

Elide is a Java library that lets you stand up a GraphQL/JSON-API web service with minimal effort.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java100.0%

[8]ページ先頭

©2009-2025 Movatter.jp