Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Wrongful errors for formData / type: integer #21

Closed
netzkind opened this issue May 9, 2017 · 2 comments
Closed

Wrongful errors for formData / type: integer #21

netzkind opened this issue May 9, 2017 · 2 comments

Comments

@netzkind
Copy link

netzkind commented May 9, 2017

Affected version: HippieSwagger 2.1.0

Specification:

parameters:
  quantity:
    name: quantity
    in: formData
    type: integer
    format: int32
    required: true

Code/Request:

hippieSwagger(app, dereferencedSwagger)
	.form()
	.post('/url')
	.send({
		quantity: 1
	})
	.expectStatus(200)

Result:

Error: Invalid format for parameter {quantity}, received: 1. errors:data should be integer

As far as i have seen, this happens because hippie-swagger decomposes the query-string for validating the parameters - meaning 1 (integer) has changed to "1" (string), thus failing in ajv.

@netzkind
Copy link
Author

netzkind commented Jun 16, 2017

I have created tests in hippie-swagger to prove the problem: netzkind@e0b7c6f

I see however no easy fix:
apparantly, the method paramHashFromHippie only receives a querystring-version of the formData-parameters from hippie, and is thus not able to access the original parameters and their type.

@CacheControl
Copy link
Owner

Fixed in 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants