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

OS3 request validator skip if link does not exist #240

Merged
merged 1 commit into from
Sep 4, 2019

Conversation

yhirano55
Copy link
Member

Summary

  • When link does not exist in schema.json, it seems that request object coerced change with unpack.
  • It looks it's not intentional behavior, so I've added guard clause which checks link exists or not before validation.

@yhirano55 yhirano55 requested a review from ota42y September 4, 2019 09:34
@@ -256,7 +256,7 @@ def app
it "rescues JSON errors" do
@app = new_rack_app(schema: open_api_3_schema)
header "Content-Type", "application/json"
post "/apps", "{x:y}"
post "/characters", "{x:y}"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path doesn't exist, it returns 200. To test JSON errors, I changed existing path. :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -49,7 +51,6 @@ def coerce_form_params(_parameter)
attr_reader :validator_option

def coerce_path_params
return {} unless link_exist?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@@ -256,7 +256,7 @@ def app
it "rescues JSON errors" do
@app = new_rack_app(schema: open_api_3_schema)
header "Content-Type", "application/json"
post "/apps", "{x:y}"
post "/characters", "{x:y}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ota42y ota42y merged commit 44d3b81 into master Sep 4, 2019
@ota42y ota42y deleted the os3_validator_skip_if_link_does_not_exist branch September 4, 2019 09:44
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

Successfully merging this pull request may close these issues.

2 participants