We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If I use Committee::Middleware::RequestValidation, the date-time conversion is done at the same time as the request is processed. Then, if I run assert_request_schema_confirm, the conversion is already completed and the validation will fail in the following part https://github.com/ota42y/openapi_parser/blob/v0.12.1/lib/openapi_parser/schema_validators/string_validator.rb#L11 At this time, the value is already converted to DateTime.
Committee::Middleware::RequestValidation
assert_request_schema_confirm
DateTime
Is this a bug? If you have any solutions, please let me know.
ruby 2.7.1 rails 6.0.3.2 committee 4.2.0 rspec 3.9.0
config.middleware.use Committee::Middleware::RequestValidation, schema_path: schema_path, parse_response_by_content_type: false
/contents: get: summary: example description: example parameters: - in: query name: q description: filtering required: false style: deepObject schema: type: object description: filtering properties: start_at_gteq: type: string description: start_at greater than or equal format: date-time example: "2019-10-01T00:00:00+9:00" nullable: true end_at_lteq: type: string description: end_at less than or equal format: date-time example: "2019-10-31T23:59:59+9:00" nullable: true responses: "200": description: contents list ...
it "foo" do get contents_url(q: { start_at_gteq: "2020-01-01", end_at_lteq: "2020-01-31" }) assert_request_schema_confirm assert_response_schema_confirm expect(response).to have_http_status(:success) end
Committee::InvalidRequest: #/.../schema/properties/end_at_lteq expected string, but received DateTime: 2020-01-31T00:00:00+00:00 0) ContentsController request spec GET #index ... Failure/Error: assert_request_schema_confirm Committee::InvalidRequest: #/.../schema/properties/end_at_lteq expected string, but received DateTime: 2020-01-31T00:00:00+00:00 # ./spec/spec.rb:98:in `block (6 levels) in <top (required)>' # ------------------ # --- Caused by: --- # OpenAPIParser::ValidateError: # #/.../schema/properties/end_at_lteq expected string, but received DateTime: 2020-01-31T00:00:00+00:00 # ./spec/spec.rb:98:in `block (6 levels) in <top (required)>'
The text was updated successfully, but these errors were encountered:
Well, there seems to be a problem because I wasn't thinking about using this function at the same time.
It seems that we need to add warning or put in some workaround.
Sorry, something went wrong.
Thank you. I'll let you know if I come up with any workarounds as well.
No branches or pull requests
Description
If I use
Committee::Middleware::RequestValidation
, the date-time conversion is done at the same time as the request is processed.Then, if I run
assert_request_schema_confirm
, the conversion is already completed and the validation will fail in the following parthttps://github.com/ota42y/openapi_parser/blob/v0.12.1/lib/openapi_parser/schema_validators/string_validator.rb#L11
At this time, the value is already converted to
DateTime
.Is this a bug?
If you have any solutions, please let me know.
Environment
application.rb
OpenAPI 3.0 yaml
spec
spec result
The text was updated successfully, but these errors were encountered: