Comments (4)
Hi @Lazarus404, with the current version of open_api_spex, you get the path/query params merged into the requestBody struct if the schema allows additionalProperties
.
It feels like a hack, so I wonder if there is a better way?
Some ideas that come to mind:
- Store the result of casting the request body in
conn.body_params
?
This would require matching onbody_params
separately to the query/path params in controllers:
def create(conn = %{body_params: body = %UserRequest{}}, params = %{id: id}) do
... use id and body
- Store the cast body in a reserved key like
:"$body"
in the combined params map?
def create(conn, params = %{id: id, "$body": body = %UserRequest{}}) do
... use id and body
What do you think?
from open_api_spex.
I think option 1 would be more correct. This way, no toes are ever stood on. It has my vote.
from open_api_spex.
@Lazarus404 I've put together a change in #39
from open_api_spex.
Resolved in #39, thanks for reporting this @Lazarus404 👍
from open_api_spex.
Related Issues (20)
- Schema oneOf among integer and string doesn't work with integer in a string ("1234") HOT 1
- Examples for anyOf generate by example/1 are broken
- How can I do it when a parameter (in: query) is composed ? HOT 1
- Confusion around reading YAML into ApiSpec HOT 3
- Is it possible to pretty print error responses? HOT 3
- Clash of different schemas with the same title
- Params by plug convention should contain merged path, body and query parameters HOT 1
- AllOf cast returns a map, but I expected a struct HOT 3
- How to pass dynamic key-value pairs in the query
- Problem with nested oneOf in allOf HOT 2
- Nullable and patern HOT 1
- Default JsonErrorResponse schema references out-of-date name for HTTP 422 HOT 1
- New release for ymlr v5 support? HOT 4
- Accepts non-RFC3339 timestamps in date-time HOT 1
- Accept a nonce for SwaggerUI to allow strict CSPs HOT 1
- Custom error messages HOT 1
- Cast number schema should return float HOT 1
- Response's content property spec seems reversed HOT 1
- Add a `--check` flag to `mix openapi.spec.json` and `mix openapi.spec.yaml` HOT 4
- Sending multipart/form-data POST requests HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open_api_spex.