metosin / metosin/compojure-api

Automatically push `context` parameters into endpoints when safe

Open
#463 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
1.1k
Forks
146
PR merge metrics
No merged PRs in 30d

Description

Presents more opportunities to infer static contexts.

```clojure
(context "/foo" []
:path-params [id :- s/Str]
(PATCH "/" []
(ok id))
(GET "/" []
(ok id)))
```
=>
```clojure
(context "/foo" []
(PATCH "/" []
:path-params [id :- s/Str]
(ok id))
(GET "/" []
:path-params [id :- s/Str]
(ok id)))
```

typed.clj.analyzer would be useful here as we both need to infer where locals occur and also do partial macroexpansion.

Contributor guide

Open the contributing guide

Research direction

Start by reading typed.clj.analyzer, which the issue identifies for locating locals and performing partial macroexpansion. Compare the context example with the desired expanded endpoint parameters; done means safely moving static context parameters into each applicable PATCH and GET endpoint without changing other cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.