Skip to content
/ apex Public

A compendium of Clojure libraries for implementing web backends.

License

Notifications You must be signed in to change notification settings

juxt/apex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apex

Apex stands for API Execution.

Apex is a Clojure library that produces Ring handlers from OpenAPI descriptions.

Apex is a Clojure web library that takes an Open API 3.0 description, some attachments, and returns a Ring handler.

Status

PRE-ALPHA:

Apex libraries are broadly applied as Ring middleware, where possible.

Some of these libraries will be marked as ready for use prior to others. For now, this project is being developed in the open for the purposes sharing ideas and code and not recommended for use in production systems.

Getting started

Start with the petstore example in examples/petstore. See examples/petstore/README.adoc.

Individual modules are:

params

An implementation of OpenAPI parameter parsing.

oauth2

An implementation of OpenID Connect upon OAuth2 driven by OpenID Connect Discovery configuration.

Objective

Apex will be considered a success if it meets the following acceptance criteria:

  • Developers with limited experience of Clojure can create web APIs without too much difficulty, including security.

  • Web APIs created with Apex are broadly conformant to HTTP standards and performance is acceptable for the vast majority of use-cases.

This requires the following:

  • Error handling is informative and leads developers quickly to the actual cause of the error.

Rationale

yada, the web library we wrote to replace Liberator, is beginning to show its age. When we started yada, the web looked a little different than today:

  • There was no async option in Ring, and we wanted to avoid the thread-per-request model for some of the high-traffic websites we were producing in our consulting projects.

  • Prismatic Schema was firmly established as the way to specify constraints on data.

In the years since yada was conceived, designed and developed, there have been a number of external developments:

  • Ring now has a well thought out approach to async, supporting modern asynchronous web servers without sacrificing the composeability of middleware.

  • OpenAPI (formerly Swagger) continues to attract users, adopted by large organisations, and has now matured and is now governed by The Linux Foundation.

  • JSON Schema continues to mature. (We like it so much we’ve even written our own Clojure library, jinx)

  • Vert.x, an asynchronous networking library on the JVM has emerged and stabilised. It is well maintained, with an active community. It is also based on Netty, providing a suitable and comprehensive replacement for Aleph, adopted by yada. In addition, it provides robust support for asynchronous multipart/formdata requests.

  • Reactive Streams has matured and found its way into the core JDK (as java.util.concurrent.Flow). While manifold, used by yada, was years ahead of its time, there are now other well-established alternatives for asynchronous processing with back-pressure. AsyncAPI is also emerging as an asynchronous complement to OpenAPI.

OpenAPI: the missing piece of the web jigsaw

One of the key insights behind yada was web resources should be modelled with data. OpenAPI is now firmly established as both the de-facto and the de-jure data model of web APIs.

From Prismatic Schema to JSON Schema

The future of Prismatic Schema has been in doubt since Cognitect announced clojure.spec. While we value clojure.spec in our internal data structures, we feel that the web API community is going to move inexorably towards adoption of JSON Schema. We believe the Clojure community should welcome this trend towards a more data-oriented approach to building application systems.

Standards conformance

Standards facilitate the rich interoperable ecosystem we enjoy as both users and developers of the web. Too often conformance with established standards is the exception rather than the rule. This is a shame, as it degrades the web for everyone. Web libraries like Apex should encourage compliance due to the multiplier effect of multiple applications built on them.

License

The MIT License (MIT)

Copyright © 2020 JUXT LTD.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A compendium of Clojure libraries for implementing web backends.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages