Commit graph

439 commits

Author SHA1 Message Date
Tommi Reiman
650ff3d6b3 . 2022-03-10 15:23:07 +02:00
Tommi Reiman
f9841363c5 faster impl, removes all intermediate steps + cleanup 2022-03-10 14:21:39 +02:00
Tommi Reiman
1e5fb601da fix #538 2022-03-10 13:42:53 +02:00
Tommi Reiman
f3dee769fb format-ns 2022-02-14 16:59:20 +02:00
Tommi Reiman
2aba5610c7 format 2022-02-14 16:58:10 +02:00
Tommi Reiman
d0f7126491 add support for malli-lite 2022-02-14 16:45:14 +02:00
Tommi Reiman
bdcb1eb5b1 clean-ns 2022-02-12 22:35:27 +02:00
Tommi Reiman
5d4c886d35 format 2022-02-12 22:34:26 +02:00
Miikka Koskinen
9160aa0f2b Add a test for /{foo}.html style routes
Just like path `///` would not match `/{foo}/`, `/..html` does not match
`/{foo}.html`.
2021-10-06 20:42:09 +03:00
Tommi Reiman
38f2bd4812
Merge branch 'master' into fix-resource-handler-url-decoding 2021-08-03 13:33:39 +03:00
Tommi Reiman
5486174722
Merge pull request #501 from metosin/malli-fix
Fix malli encoding & update deps
2021-08-03 13:29:53 +03:00
Tommi Reiman
020c424b4e dead code, CHANGELOG 2021-08-03 13:24:29 +03:00
Tommi Reiman
20b7cabed7 Fix Malli encoding,, #498 2021-08-03 08:46:51 +03:00
Dieter Komendera
056c70d269 Enrich request for pedestal/routing-interceptor default-queue
This ensures requests handled by the default queue also have
access to the router per the injected :reitit.core/router key
on the request.
2021-06-24 14:07:23 +02:00
Miikka Koskinen
1297cfd902 Handle URL-encoded paths in file and resource handlers 2021-04-30 14:38:18 +03:00
Miikka Koskinen
1b74373911 Use explicit :refers 2021-04-23 17:15:35 +03:00
Miikka Koskinen
1b583c1cc2 Remove operation-id uniqueness check
Let's leave that for other tools for now.
2021-04-23 17:02:17 +03:00
Miikka Koskinen
5824d9eeef Make the not-found-handler fix backwards compatible
PR #471 aimed to fix issue #464. However, the change was slightly
backwards-incompatible, since it made the file and resource handlers use
the default 404 handler when mounted outside of the router. The previous
behavior was to return nil in that case.

This patch restores the previous behavior and clarifies that `:path`
option can be used only when the file/resource handler is mounted
outside of a router.
2021-02-26 08:14:01 +02:00
Miikka Koskinen
88897a2264 Remove useless testing calls 2021-02-26 07:41:03 +02:00
Kari Marttila
902b33f004 Support not-found-handler with path in resource handler (#464) 2021-02-19 15:17:26 +02:00
Kimmo Koskinen
496e6b6fc7 Allow space as separator, fixes #411
Fixes https://github.com/metosin/reitit/issues/411
2021-01-29 15:02:35 +02:00
Timo Kramer
e095cd2efa Support operationId in reitit-swagger
OpenAPI Specification allows the operationId to be added to the
"Operation Object" alongside e.g. summary and description. This
commit introduces the support of this element in the
reitit-swagger module and extends the tests. One test shows the
correct use of operationId where both are distinct and one
shows the failing of the swagger creation when the IDs are not
distinct.

- Spec: https://swagger.io/specification/#operation-object
- Adds the support for operationId
- Adds operationId in two places of the swagger test
- Adds a test that checks exception on duplicate IDs
- Closes #451
2020-11-25 18:38:35 +01:00
Tommi Reiman
f2f7d3a428
Merge pull request #438 from metosin/frontend-fixes
Frontend fixes
2020-10-19 10:42:45 +03:00
Tommi Reiman
9ce7e6593c malli 0.2.0, update docs & tune 2020-10-18 20:22:01 +03:00
Kimmo Rantala
2ed5b48067 Fix resource handler path matching
File/resource handler checks that uri actually matches to path instead
of comparing just path length to uri length.
2020-10-15 23:33:20 +03:00
Juho Teperi
845240d330
Merge branch 'master' into frontend-fixes 2020-10-15 09:49:14 +03:00
Tommi Reiman
39ec264da8
Merge pull request #417 from Koura/issue-217-consume-form-params
Issue 217 consume form params
2020-09-30 12:25:52 +03:00
Juho Teperi
58f9871747 Test rfe start! 2020-09-26 16:51:19 +03:00
Tommi Reiman
fbff819909 update deps 2020-09-26 12:11:14 +03:00
tjalkane
ce635609c7 Omit swagger-data for muuntaja middleware/interceptor
Leave out swagger-data when `:form`, but no `:body` parameters, are
defined. If swagger-data is not omitted, order of parameters and
muuntaja middleware will matter.
2020-07-10 09:52:20 +03:00
tjalkane
6703a02baa Publish Swagger :consumes for parameters-interceptor
Make parameters-interceptor automatically publish swagger data for
endpoints when :form, but not :body params, are present.
2020-07-08 10:18:57 +03:00
tjalkane
15df0c5005 Automatically publish Swagger :consumes for :form params
Make parameters-middleware publish swagger data for endpoints when
:form, but not :body params,
are present.
2020-07-08 10:07:43 +03:00
tjalkane
c1c3cd26b4 Remove duplicate require of schema.core 2020-06-26 00:25:09 +03:00
tjalkane
87d7e2e3c9 Fix: rename a test to make it run
The renamed test is redeclared later in the same namespace
causing the original one to not be run with `lein test`.
2020-06-26 00:16:06 +03:00
Tommi Reiman
681c994f7f Test that middleware swagger injections work 2020-05-26 22:35:43 +03:00
Tommi Reiman
f2e0470ecd
Merge pull request #408 from metosin/PR
Better malli-coercion
2020-05-26 22:03:45 +03:00
Tommi Reiman
57da6fa5ad optimized http-coercion 2020-05-26 21:32:26 +03:00
Tommi Reiman
e649ed22b9 New options for malli coercion 2020-05-26 08:09:35 +03:00
Tommi Reiman
f41006c8bb just validation 2020-05-25 23:50:27 +03:00
Tommi Reiman
a2d8208600 Fix #407 2020-05-25 21:54:27 +03:00
piotr-yuxuan
3e8eaa48d7
Fix default description
https://github.com/metosin/reitit/issues/403
2020-05-19 23:42:56 +01:00
Tommi Reiman
920c9d7cfd nil-punning on routes 2020-05-17 10:34:44 +03:00
Tommi Reiman
b1c8dbdaa4 Update sieppari, fix tests 2020-05-16 17:34:55 +03:00
Tommi Reiman
ddf56624b7 Update swagger test 2020-05-16 14:08:08 +03:00
Tommi Reiman
26dcbef5d1 Add tests for missing sieppari asyncs 2020-05-16 14:06:45 +03:00
Tommi Reiman
d36c47d7b1 :reitit.ring/default-options-endpoint & :reitit.http/default-options-endpoint 2020-05-12 21:21:39 +03:00
Tommi Reiman
fd0d7cc46c Add create-file-handler, fixes #395 2020-05-12 21:05:12 +03:00
Tommi Reiman
b8b442b598 Fix #394 2020-05-12 21:05:12 +03:00
Tommi Reiman
79c430d298 Fix tests 2020-05-12 21:04:35 +03:00
Tommi Reiman
9e7df6ca03 Support expand on default-options-endpoint 2020-05-12 20:11:39 +03:00
Caio Oliveira
029894b984
testing assertion 2020-05-12 10:46:53 -04:00
Caio Oliveira
4fa3e12b49
resource -> endpoint 2020-05-12 10:37:13 -04:00
Caio Oliveira
5796df494e
Change default-options-handler to default-options-resource
To make the options resource more customizable.
2020-04-11 20:46:06 -04:00
Tommi Reiman
c5dc91af89 Update tests & CHANGELOG 2020-04-06 10:57:12 +03:00
Juho Teperi
03009f5ca4 Ensure rfe/history is set during initial on-navigate call
Fixes #315
2020-03-05 15:32:16 +02:00
Juho Teperi
c4e84c2875 Add clj-kondo and fix most linting warnings 2020-03-05 13:32:48 +02:00
Juho Teperi
c214622495 Fix malli tests 2020-03-05 12:35:37 +02:00
Tommi Reiman
9b024db897 Response coercion is decode + validate + encode 2020-01-07 07:03:57 +02:00
Tommi Reiman
9200afe814 Polish tests 2020-01-06 21:49:41 +02:00
Tommi Reiman
91a2945578 Add support for default values 2019-12-30 22:58:05 +02:00
Tommi Reiman
3c61824f1d malli coercion + strip extra keys by default with spec 2019-12-28 00:51:41 +02:00
Tommi Reiman
93f947831d malli + swagger docs 2019-12-27 22:03:52 +02:00
Tommi Reiman
10be520a0d Malli + coercion 2019-12-27 22:03:52 +02:00
Matt Russell
5aac69f563 Add metosin/ring-http-response support to exception middleware. 2019-12-12 22:29:17 +00:00
Pauli Jaakkola
6d5bf64833 Implement encoding of multi-valued query params. 2019-12-02 15:33:55 +02:00
Pauli Jaakkola
0adb820bba Collect multi-valued query params into vector. 2019-11-15 12:53:32 +02:00
Ilmo Raunio
e092001568 Add test cases to check for deep paths 2019-11-13 22:49:21 +02:00
Ilmo Raunio
8a86701902 Allow path conflict resolution with :conflicting 2019-11-13 22:49:21 +02:00
Tommi Reiman
e2a297a69d More tests, fixes #320 2019-10-10 15:09:58 +03:00
Daw-Ran Liou
69795f5fe7 Tighten middleware spec from collection to vector
This avoids messing up the order of middleware chain accidentally.
2019-10-09 18:38:32 +03:00
Daw-Ran Liou
4a199b918a Add test to validate middleware cannot be list
When meta-merges list with a vector, the resulting order is reversed. To avoid
this for the middleware chain, middleware cannot be lists.
2019-10-09 18:38:32 +03:00
Alexander Kiel
a19849fe58 Make Map Destructuring of Namespaced Keys more Beautiful
It's possible to put the :keys keyword in the namespace of the keys one likes to
destructure. With that one can use symbols in the vector again. One advantage of
having symbols is, that Cursive grays them out if not used. I found two
occurrences of unused destructured keys.
2019-07-13 17:02:41 +03:00
Tommi Reiman
91e860f6c6 Support 3-arity handler for default-options-handler 2019-06-16 20:11:19 +03:00
Tommi Reiman
47906df7b9 Update deps & docs 2019-06-15 11:49:11 +03:00
Tommi Reiman
46897f3927 Update docs 2019-06-09 20:46:20 +03:00
Tommi Reiman
c9281f0e89 support :parameter-syntax option in router 2019-06-09 20:29:03 +03:00
Tommi Reiman
fdca962d60 Less config for the test 2019-05-23 18:56:54 +03:00
Tommi Reiman
37deaa3b9e Check also pedestal interceptor key values, fixes #285 2019-05-23 18:53:27 +03:00
Daniel Sunnerek
372d7e7509 [#283] Allow to pass some defaults to create-default-handler 2019-05-23 13:18:49 +02:00
Tommi Reiman
5efdc67954
Merge pull request #281 from malesch/feature/fix-typos
Fix a bunch of typos
2019-05-22 21:47:36 +03:00
Tommi Reiman
38d419a82b Fix typo 2019-05-22 21:12:13 +03:00
Marcus Spiegel
8dcebcf49f Fix typos 2019-05-22 19:17:10 +02:00
Tommi Reiman
4933927fa9 Add a failing test 2019-05-22 16:34:25 +03:00
Kevin van Rooijen
259dd24105 Add test to ensure that the problems key is populated 2019-05-20 18:37:55 +02:00
Tommi Reiman
ad0bc7e013 Better errors for route-data merge errors 2019-05-15 22:54:35 +03:00
Tommi Reiman
6d263ae1b6 Test Pedestal error mapping, add dev helpers 2019-05-11 10:25:09 +03:00
Tommi Reiman
e70837b140
Merge pull request #263 from metosin/north
Closed spec validation demoed in Clojure/North (WIP)
2019-05-10 14:28:39 +03:00
Tommi Reiman
c3de6ff3dd Fix tests 2019-05-01 22:40:44 +03:00
Valtteri Harmainen
f7332d3bc4 Fix empty query params map resulting in redundant '?' in path 2019-04-27 08:22:08 +03:00
Antti Leppänen
b258e0abba Support html5 links inside Shadow DOM 2019-04-10 09:03:48 +03:00
Tommi Reiman
e41a50cb80 20% faster wildcard parameters with records 2019-03-07 08:20:41 +02:00
Tommi Reiman
5b19298803 CatchAll matcher catch with empty parameter, fixes #230 2019-03-06 19:49:27 +02:00
Tommi Reiman
850b47134a Don't reorder routes with :linear-router, fixes #229 2019-03-06 19:24:16 +02:00
Tommi Reiman
161fd1dfb0 Polish tests 2019-03-03 21:58:17 +02:00
Tommi Reiman
90e2d3b0ae Return of the spec-tests for cljs 2019-03-03 21:55:55 +02:00
Tommi Reiman
dc34720fee Fixed based on Miikka's review 2019-03-03 21:55:39 +02:00
Tommi Reiman
a2843dd097 New reitit-dev module for pretty errors 2019-03-03 20:54:21 +02:00
Tommi Reiman
998bf4a0d4 Empty colon-params are ignored 2019-03-01 22:12:11 +02:00
Tommi Reiman
f0a6ceb837 rename internals for clarity 2019-02-28 12:12:28 +02:00
Tommi Reiman
3aae55bd8c Welcome TrieCompiler 2019-02-28 12:12:28 +02:00
Tommi Reiman
aea8a8f2d5 Emoji routing 2019-02-28 12:12:28 +02:00
Tommi Reiman
9422cd28c1 create empty path-parameters at creation time, 266ns->251ns (-6%) 2019-02-28 12:12:28 +02:00
Tommi Reiman
69550febfa dead code 2019-02-28 12:11:05 +02:00
Tommi Reiman
d68e1b81fb FIx cljs, welcome reitit.exception! 2019-02-28 12:11:05 +02:00
Tommi Reiman
8abca179d0 Test unicode chars 2019-02-28 12:11:05 +02:00
Tommi Reiman
ae1a8f7919 Fail fast with multiple terminators. 2019-02-28 12:11:05 +02:00
Tommi Reiman
df38a0de05 Test bracket syntax + fix trie conflicting rules 2019-02-28 12:11:05 +02:00
Tommi Reiman
cecd6cf526 Start working on cljs trie 2019-02-28 12:11:05 +02:00
Tommi Reiman
907e0b5c97 dead code 2019-02-28 12:11:05 +02:00
Tommi Reiman
6f902d118a Free from the regex! 2019-02-28 12:10:01 +02:00
Tommi Reiman
8628f0cec6 Remove segment-rouiter code 2019-02-28 12:10:01 +02:00
Tommi Reiman
ce80f83319 :segment-router -> :trie-router 2019-02-28 12:10:01 +02:00
Tommi Reiman
b1bef1c1cc Fix #216 2019-02-19 19:40:26 +02:00
Juho Teperi
36109f142c Replace controller :params with :identity and :parameters 2019-02-08 10:22:29 +02:00
Juho Teperi
c314707afb Add utils to create common controller :params functions 2019-02-08 10:21:19 +02:00
Juho Teperi
9d6b0071fc Call :stop for controllers in reverse order 2019-02-08 10:21:19 +02:00
Tommi Reiman
bc26eaed83 Fix tests 2019-02-03 15:13:28 +02:00
Tommi Reiman
16b6b8ad9f
Merge pull request #210 from nilern/toposort
Middleware/interceptor dependency resolution algorithm
2019-02-03 15:05:44 +02:00
Tommi Reiman
62f908d988 Second fix to #209 2019-01-26 16:34:16 +02:00
Tommi Reiman
b2cd7f37e2 Fix #209 2019-01-26 16:17:13 +02:00
Pauli Jaakkola
b02ccdd53b #33 Add dependency reolution algorithm. 2019-01-25 16:45:46 +02:00
Tommi Reiman
b8d8286265 Fixes for the SegmentTrie 2019-01-15 22:13:12 +02:00
Tommi Reiman
433cf9102d . 2019-01-15 22:05:00 +02:00
Tommi Reiman
393049a772 Oh My Java: safe guard against index overflows. 2019-01-14 21:08:20 +02:00
Tommi Reiman
9e58f93cc9 test all calfpath perf 2019-01-14 20:41:58 +02:00
Tommi Reiman
b847af4ae7 Fix segment tests 2019-01-14 10:45:27 +02:00
Tommi Reiman
35ff62a1da Fix expand, fixes #201 2019-01-14 10:07:16 +02:00
Tommi Reiman
2ec29b8f9d Polish docs 2018-12-30 16:53:15 +02:00
Tommi Reiman
48961c9ed4 quarantine-router 2018-12-22 10:37:18 +02:00
Tommi Reiman
260b167853 Decode path-params on match-by-name, fixes #192 2018-12-21 20:17:46 +02:00
Tommi Reiman
492d5e2f2b Segment-router doesn't allow empty path-parameters 2018-12-10 20:30:58 +02:00
Tommi Reiman
ed1c2b0c4f Add coercion tests for vector data-specs, 0.2.9 2018-11-21 16:02:04 +02:00
Heikki Hämäläinen
24c146a702 Add support for vector based specs in Swagger generation
This allows data specs to be in vectors as well as maps. Before the change data spec [{:foo string?}] would throw exception when generating Swagger.
2018-11-21 14:23:33 +02:00
Tommi Reiman
ffc36fce36 Support composable transformations of mw/interceptor chain
* fixes #167
2018-11-18 22:19:30 +02:00
Tommi Reiman
cca55c5bd5 Add regression test for swagger-spec 3arity handler 2018-11-17 21:25:40 +02:00
Tommi Reiman
37cb99a13e Expose spec problems to error handlers 2018-11-17 20:50:04 +02:00
Hannu Hartikainen
6a7fb095cb Support stripping multiple slashes
One inspiration for stripping/adding slashes automatically in reitit was
https://github.com/julienschmidt/httprouter which can handle any number
of slashes. Make the implementation a bit better by stripping as many
slashes as there are.

This still doesn't support redirecting from a multiple-slash URI to a
single-slash URI. That could be handled as a special case, but in the
end I think the correct solution would be to convert both the router and
request URIs to a canonical form before matching. Then the question of
slashes is just a question of formatting.
2018-10-31 09:48:13 +02:00
Hannu Hartikainen
52a476c661 Fix tests (add missing require) 2018-10-31 08:48:14 +02:00
Tommi Reiman
763440e41f Format code 2018-10-30 19:50:18 +02:00
Unknown
da29203cc8 Add tests for :strip and :both 2018-10-30 23:48:35 +09:00
Unknown
ad8384022c Add tests for the slash-redirect :add case 2018-10-30 23:23:13 +09:00
Tommi Reiman
45eab09d7a Fix tests 2018-10-28 20:19:40 +02:00
Tommi Reiman
0095aece21 Router is injected into request in the default branch
* releated to #159
2018-10-28 18:20:35 +02:00
Tommi Reiman
5046aebec8 Allow any kind of model 2018-10-16 20:25:43 +03:00
Unknown
a00798a0f5 Adjust tests to allow string keys 2018-10-16 22:57:33 +09:00
Tommi Reiman
c0201ce2f0 test parameters-interceptor 2018-09-24 20:27:42 +03:00
Tommi Reiman
b015eec2a5 for http-router too 2018-09-24 20:21:53 +03:00
Tommi Reiman
a620ec5999 Set Allow-header on default-options-handler 2018-09-24 20:19:42 +03:00
Tommi Reiman
f19aae6e77 fix #150 2018-09-23 16:42:45 +03:00
Tommi Reiman
fb95a1e303 Test top-level handler override 2018-09-23 11:27:33 +03:00