Commit graph

481 commits

Author SHA1 Message Date
Joel Kaasinen
7fb9c27e46
feat: use request Content-Type or :muuntaja/content-type to coerce
Previously, `extract-response-format-default` was only looking at
(-> request :muuntaja/response :format). This led to wrong behaviour
when there were separate schemas for separate response content types
and an explicitly picked content-type for the response.
2025-10-29 10:54:10 +02:00
Joel Kaasinen
c684c83c99 chore: update openapi-schema-validator, fix test
validator now disallows having both "example" and "examples"
2025-10-24 15:38:29 +03:00
Joel Kaasinen
d2f44b8015 fix: match-by-name! should throw when match-by-name is PartialMatch
If a path param was nil, match-by-name (via impl/path-for) was
treating the parameter as missing, but match-by-name!
(via impl/throw-on-missing-path-params) was treating it as present.

That is:

(reitit/match-by-name router :page {:id "1"}) ;; => Match
(reitit/match-by-name router :page) ;; => PartialMatch
(reitit/match-by-name router :page {:id nil}) ;; => PartialMatch

(reitit/match-by-name! router :page {:id "1"}) ;; => Match
(reitit/match-by-name! router :page) ;; => ExceptionInfo: missing path-params for route /pages/:id -> #{:id}
(reitit/match-by-name! router :page {:id nil}) ;; => nil  !!!

fixes #758
2025-10-24 09:58:03 +03:00
Joel Kaasinen
9509e40dae
Merge pull request #756 from metosin/feat/defaults-for-optional-keys
setting default values for optional keys in malli coercion
2025-10-13 15:38:45 +03:00
Joel Kaasinen
67918a3f9c feat: reuse :default-values config key instead of adding a new one 2025-10-13 15:18:29 +03:00
Joel Kaasinen
d809291553 test: ring-handler middleware from registry inside router 2025-10-13 09:01:21 +03:00
Joel Kaasinen
f26dc1ab19 feat: :default-values-for-optional-keys for malli coercion 2025-10-10 08:51:05 +03:00
Joel Kaasinen
05bc331397 feat: allow multimethods as :handlers in validation
fixes #749
2025-10-07 15:50:51 +03:00
Joel Kaasinen
5025ca3a75 fix: response coercion for unlisted http statuses, when no default
fixes #742
2025-05-27 12:09:38 +03:00
Joel Kaasinen
2bf8aa98a7 test: malli now uses . instead of ~1 in json-schema/swagger $refs
update our assertions accordingly
2025-05-12 14:28:19 +03:00
Joel Kaasinen
7a77c9f86b
Merge pull request #735 from metosin/response-default
Resurrect :responses :default
2025-04-29 09:30:02 +03:00
Joel Kaasinen
a8b4bc0d2d feat: rework & document response coercer defaulting rules 2025-04-28 10:01:09 +03:00
Joel Kaasinen
9797725ae8
Merge pull request #714 from mokshasoft/openapi3-parameter-deprecation
Place the openapi deprecation tag directly under parameters
2025-04-25 15:13:26 +03:00
Joel Kaasinen
9534f6df8b feat: avoid duplicated :description for openapi parameters 2025-04-25 15:04:51 +03:00
Joel Kaasinen
a390180975 test: add description and deprecated to openapi-test 2025-04-25 15:03:40 +03:00
Joel Kaasinen
f038fe1941 test: corner cases in how :responses :default gets applied 2025-04-24 09:31:27 +03:00
Joel Kaasinen
dd835e73a8 feat: allow :default response status code again
it is an old feature, but didn't have a test, so it was broken by #715

also add a test so we don't break it again
2025-04-11 10:30:52 +03:00
Eva Ogbe
e16c95c5b3 Add mime-types option to static handler 2025-04-07 20:35:58 -04:00
Loukas Agorgianitis
3342e77538
Change default index-redirect? value to false
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
2025-03-28 15:14:15 +02:00
Loukas Agorgianitis
c2feb5b983
Add option to disable index files served on paths that are not directories
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
2025-03-28 13:49:36 +02:00
Loukas Agorgianitis
f50feff63c
Add option to allow serving index files without redirect
Signed-off-by: Loukas Agorgianitis <loukas@agorgianitis.com>
2025-03-25 23:07:36 +02:00
Joel Kaasinen
d5d46d5b0b
Merge pull request #715 from filipesilva/coerce-response-int
fix: throw if response status is not int
2025-02-25 12:49:23 +02:00
Filipe Silva
f0fc440425 fix: throw if response status is not int
Fix #667
2025-02-25 10:12:47 +00:00
Juho Teperi
5ca22193d0 Use defined :string :default transformer for query-string-coercer 2025-01-31 09:39:19 +02:00
Juho Teperi
7e9116f77e Simplify Malli coercion for query-params to only encode 2025-01-28 15:09:31 +02:00
Juho Teperi
7ae118fbb5 Move query string coercion to coercion ns from core 2025-01-28 14:34:21 +02:00
Juho Teperi
7ae2bfafc2 Cleanup 2025-01-22 14:20:02 +02:00
Juho Teperi
1b37c87aa2 Test set-query without a match 2025-01-22 14:18:54 +02:00
Juho Teperi
f60a7ad902 Fixes 2025-01-22 14:05:45 +02:00
Juho Teperi
1ba77a7267 Apply query parameters encoding on rfe/set-query 2025-01-22 14:05:45 +02:00
Juho Teperi
21e5840f13 Ensure extra query-string params aren't removed by coercion 2025-01-22 14:05:45 +02:00
Juho Teperi
5f10465533 Another test case 2025-01-22 14:05:26 +02:00
Juho Teperi
5829e1c656 Add reitit.frontend test case 2025-01-22 14:05:26 +02:00
Juho Teperi
25dd0abcaf Use coercion to encode query-string values in match->path 2025-01-22 14:05:26 +02:00
Juho Teperi
0a7b50a730 Test fix, silence extra cljs warnings 2025-01-22 12:09:14 +02:00
Juho Teperi
0370750a3f Run some ring tests only on jvm 2025-01-22 11:56:35 +02:00
Tommi Reiman
1abff4937c
Update exception_test.clj
ring.util.http-response should be enough
2024-12-08 14:54:14 +02:00
Eugene Pakhomov
cc1cd114e4 Make exception middleware return proper Ring responses 2024-12-07 23:47:05 +02:00
Markus Penttilä
702e7b8972 Add OpenAPI :requestBody for :form request schema
OpenAPI Specification 3 requires defining form parameters, i.e. classic
application/x-www-form-urlencoded type body as a :requestBody. They are
not supported as regular parameters like in OAS 2.
2024-10-09 22:28:57 -04:00
Dekel Pilli
f1ec7bbe8e
fix: fix bug where http ring handler would cause :path to be applied twice 2024-09-02 15:40:00 +10:00
Ben Sless
78cc54d3a8 Add generative test for new keywordize 2024-08-26 17:07:51 +03:00
Tommi Reiman
49e8d887da fixes #679 2024-06-30 17:55:47 +03:00
Tommi Reiman
129de37d3e . 2024-06-29 16:23:35 +03:00
Tommi Reiman
77f0798c06 . 2024-06-29 16:22:31 +03:00
Tommi Reiman
eb4c231c23 format 2024-06-29 16:21:35 +03:00
Tommi Reiman
2da94f733d don't merge records 2024-06-29 16:21:28 +03:00
Tommi Reiman
d136975154 format 2024-06-29 16:20:44 +03:00
Peter Strömberg
2f3fc21c84 Add arities 1 and 2 to rf/match->path
To adhere to the docstring's info about parameter 2 and 3 being optional
2024-06-21 09:59:33 +02:00
Joel Kaasinen
275b789ca9
Merge pull request #677 from metosin/improve-swagger-var-tests
test: add response schema to reitit.swagger-test/malli-var-test
2024-04-26 08:59:23 +03:00
Joel Kaasinen
18550cd297 test: add response schema to reitit.swagger-test/malli-var-test 2024-04-22 09:08:37 +03:00