Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pass all received properties to route handler #57

Closed
line-o opened this issue Sep 15, 2022 · 1 comment · Fixed by #60
Closed

Pass all received properties to route handler #57

line-o opened this issue Sep 15, 2022 · 1 comment · Fixed by #60
Labels
bug Something isn't working OAS-spec This has to do with the OAS specification compliance released

Comments

@line-o
Copy link
Member

line-o commented Sep 15, 2022

Regardless of the properties-property that might be present in the schema for an encoding in requestBody, all properties must be passed to the route handler function.

Relevant spec
The properties is not mandatory and additionalProperties, which handles not explicitly listed properties defaults to true.

At the moment Roaster will only pass properties to the route handler that are explicitly listed as if additionalProperties was set to false. This is true for form-data and needs to be checked for other encodings as well.

Example requestBody definition:

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object"
        }
      },
      "application/x-www-form-urlencoded":{
        "schema": {
          "type": "object"
        }
      },
      "multipart/form-data":{
        "schema": {
          "type": "object"
        }
      }
    }
  }
@line-o line-o added bug Something isn't working OAS-spec This has to do with the OAS specification compliance labels Sep 15, 2022
@line-o line-o changed the title pass through all form-data properties when no "properties" is defined for route when no "properties" is defined for route all parameters are passed to route handler Sep 15, 2022
@line-o line-o changed the title when no "properties" is defined for route all parameters are passed to route handler Pass all received properties to route handler Sep 15, 2022
line-o added a commit to line-o/roaster that referenced this issue Sep 17, 2022
fixes eeditiones#57

- Refactor form-data parsing.
  extract into `router:parse-form-data`
  add `router:ensure-required-properties`
  add `router:validate-value`
  add `router:additional-property`
- `router:content-type` returns matching requestBody content schema and
  format hint is calculated only when needed.
line-o added a commit to line-o/roaster that referenced this issue Sep 17, 2022
fixes eeditiones#57

- Refactor form-data parsing.
  extract into `router:parse-form-data`
  add `router:ensure-required-properties`
  add `router:validate-value`
  add `router:additional-property`
- `router:content-type` returns matching requestBody content schema and
  format hint is calculated only when needed.
github-actions bot pushed a commit that referenced this issue Sep 19, 2022
## [1.7.2](v1.7.1...v1.7.2) (2022-09-19)

### Bug Fixes

* **body:** allow additional parameters by default ([d1cf5dd](d1cf5dd)), closes [#57](#57)
* **body:** some JSON bodies are strings ([29f3c1f](29f3c1f)), closes [#47](#47)
@github-actions
Copy link

🎉 This issue has been resolved in version 1.7.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working OAS-spec This has to do with the OAS specification compliance released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant