question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documenting http post request body

See original GitHub issue

I am following this code:

https://github.com/http4k/http4k/blob/master/http4k-contract/src/test/kotlin/org/http4k/contract/ContractRendererContract.kt

                receiving(Body.webForm(Strict,
                    FormField.boolean().required("b", "booleanField"),
                    FormField.int().optional("i", "intField"),
                    FormField.string().optional("s", "stringField"),
                    json.lens(FormField).required("j", "jsonField")
                ).toLens())

I would like to use this part to document form field of Apple login response:

                receiving(Body.webForm(Strict,
                    FormField.string().required("code", "stringField"),
                    FormField.string().required("user", "jsonField:" + AppleUserInfo(AppleUserInfoFirstAndLast("Jane", "Doe"), "jane@doe.net"))
                ).toLens())

This is not ideal as I pass the JSON example as String, without Lens support. However I couldn’t figure out how to do this correctly.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
knyttlcommented, Jul 9, 2020

Thanks. In such case we can close this.

0reactions
daviddentoncommented, Jul 9, 2020

whilst the schema descriptions are supported by OA3 for all.types of parameter, unfortunately there currently isn’t a way to add Json examples for non-body parameters . we only currently support the basic Json primitives (string/Boolean etc) for these parts (query/form.fields etc).

unfortunately I’m pretty sure the changes to the internal to add these would be pretty extensive because of the way in which things are written.

Read more comments on GitHub >

github_iconTop Results From Across the Web

POST - HTTP - MDN Web Docs
The HTTP POST method sends data to the server. The type of the body of the request is indicated by the Content-Type header....
Read more >
Add a Request Body to a POST Request | API Connector
This article describes how to add a request body to a POST , PUT , or PATCH request in the API Connector extension...
Read more >
How do I make a POST request? - ReqBin
To make a POST request to an API endpoint, you need to send an HTTP POST request to the server and specify a...
Read more >
Describing Request Body - Swagger
Request bodies are typically used with “create” and “update” operations (POST, PUT, PATCH). For example, when creating a resource using POST or PUT,...
Read more >
Submitting a POST Request to the REST API | Junos OS
Use an HTTP POST request to send single or multiple RPC requests to the REST API. ... in the URI for POST requests,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found