https://kotlinlang.org logo
#http4k
Title
# http4k
d

dave

04/23/2019, 9:45 PM
@Nezteb It should match the number of args ok. Can you post more of the code? (Including the full path)
n

Nezteb

04/23/2019, 9:46 PM
d

dave

04/23/2019, 9:50 PM
The sig of the function to create the handler only takes the path parts as args
Where will the orgId and CWI come from?
Guessing that the orgid is the path?
n

Nezteb

04/23/2019, 9:52 PM
orgId will be in the path, CWI will be a JSON object in the Body. does the contract need to specify those before it can be mapped to the function?
d

dave

04/23/2019, 9:53 PM
So it matches the greet example here. https://www.http4k.org/guide/modules/contracts/
The path arg needs to be mapped in the spec. The body lens you will use manually to extract from the request
If you want it to appear in the contract (OpenAPI) then it will also need to be added to the Meta block
n

Nezteb

04/23/2019, 9:55 PM
Ohhhhh, I see. So body arguments are not taken as function arguments. They use lenses on the request.
except for Path/Query/Header params, correect?
d

dave

04/23/2019, 10:04 PM
Only the path parameters make up that signature. The rest are retrieved.manually.
(once again, this is down to the inability to create types with varying generic args)
n

Nezteb

04/23/2019, 10:05 PM
Got it. That makes sense. 😄
d

dave

04/23/2019, 10:06 PM
🙃
2 Views