Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xsc/ronda-routing-schema
Schema Validation based on RouteDescriptor Metadata
https://github.com/xsc/ronda-routing-schema
Last synced: 27 days ago
JSON representation
Schema Validation based on RouteDescriptor Metadata
- Host: GitHub
- URL: https://github.com/xsc/ronda-routing-schema
- Owner: xsc
- License: mit
- Created: 2015-02-27T09:34:12.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-17T13:11:15.000Z (about 9 years ago)
- Last Synced: 2024-04-14T04:55:46.317Z (7 months ago)
- Language: Clojure
- Homepage: https://xsc.github.io/ronda-routing-schema/
- Size: 214 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ronda-routing-schema
Combines [ronda/routing][routing] and [ronda/schema][schema] to provide
request/response schema validation based on `RouteDescriptor` metadata.## Usage
__Leiningen__ ([via Clojars](https://clojars.org/ronda/routing-schema))
[![Clojars
Project](http://clojars.org/ronda/routing-schema/latest-version.svg)](http://clojars.org/ronda/routing-schema)__REPL__
Generate a [`RouteDescriptor`][descriptor] and a [request/response
schema][schema], then connect the two:```clojure
(require '[ronda.routing.schema :as schema])(def descriptor-with-schema
(-> descriptor
(schema/enable-schema :route1 schema1)
(schema/enable-schema :route2 schema2)))
```Afterwards, add the descriptor-based validation middleware to your stack:
```clojure
(def app-with-schema
(-> app
(schema/wrap-schemas)
...
(ronda.routing/wrap-routing descriptor-with-schema)))
```## License
```
The MIT License (MIT)Copyright (c) 2015 Yannick Scherer
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.
```[descriptor]: https://github.com/xsc/ronda-routing#route-descriptors
[routing]: https://github.com/xsc/ronda-routing
[schema]: https://github.com/xsc/ronda-schema