When using the Stoplight mock server, I encountered an issue where the validation does not work as expected when there is incorrect data. This issue affects users who rely on accurate validation responses for API testing and mocking.
Current Behavior
Instead of throwing an error for invalid data, the mock server returns a 200 OK status, incorrectly indicating that the validation passed.
Expected Behavior
When an invalid data is sent, throw a 400 error
Possible Workaround/Solution
No ideas
Steps to Reproduce
Define a new path with request body (object) in the Stoplight project
"/v1/Conversations": {
"description": "A Participant resource represents a member of the conversation.",
"post": {
"description": "Add a new participant to the conversation",
"parameters": [],
"responses": {
"201": ...
},
"requestBody": {
"content": {
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"title": "CreateConversationParticipantRequest",
"properties": {
"MessagingBinding.Address": {
"type": "string",
"description": "The address of the participant's device"
}
}
},
}
}
}
}
},
Send a request with data that does not meet the validation criteria (e.g., missing required fields or invalid field lengths).
curl -X POST "http://127.0.0.1:4010/v1/Conversations" \
--data-urlencode "MessagingBindingAddress=+15558675310" \
Observe that the server incorrectly returns a 200 OK status. MessagingBindingAddress must be MessagingBinding.Address
Context
When using the Stoplight mock server, I encountered an issue where the validation does not work as expected when there is incorrect data. This issue affects users who rely on accurate validation responses for API testing and mocking.
Current Behavior
Instead of throwing an error for invalid data, the mock server returns a 200 OK status, incorrectly indicating that the validation passed.
Expected Behavior
When an invalid data is sent, throw a 400 error
Possible Workaround/Solution
No ideas
Steps to Reproduce
MessagingBindingAddress
must beMessagingBinding.Address
Environment