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

Schema validation not working as expected when "/" available at end of the URL #2316

Closed
LayaniMal opened this issue Dec 11, 2023 · 0 comments

Comments

@LayaniMal
Copy link

Description

Schema validation is not working as expected when a trailing slash ("/") is added at the end of the URL.

Steps to Reproduce

  • Create a sample API with the SampleSwagger.yaml[1] providing a mock endpoint.
  • Enable the schema validation.
  • Create an Application, subscribe to the API, and invoke the API with an invalid schema.

Scenario 01

Request

curl --location 'https://localhost:8243/sample/1.0/api/v1/testingEnpoint' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ4NXQiOiJNell4TW1Ga09HW...' \
--data '{"test":1}'

Response

<am:fault xmlns:am="http://wso2.org/apimanager">
    <am:code>400</am:code>
    <am:message>Bad Request</am:message>
    <am:description>Schema validation failed in the Request: #: expected type: String, found: JSONObject, </am:description>
</am:fault>

Scenario 02

  • Add the "/" end of the URL and try out the same request.

Request

curl --location 'https://localhost:8243/sample/1.0/api/v1/testingEnpoint/' \
--header 'accept: */*' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJ4NXQiOiJNell4TW1Ga09HW...' \
--data '{"test":1}'

Response

  • Observe the 200 responses as below.
{
    "hello": "world"
}

[1] SampleSwagger.yaml.txt

Affected Component

APIM

Version

3.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

APIM-3.2.0

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

No branches or pull requests

2 participants