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

Request body validation is not working #2591

Open
lopenchi opened this issue Aug 13, 2024 · 1 comment
Open

Request body validation is not working #2591

lopenchi opened this issue Aug 13, 2024 · 1 comment

Comments

@lopenchi
Copy link

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

  1. 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"
                  }
                }
              },
            }
          }
        }
      }
    },
  1. 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" \
  1. Observe that the server incorrectly returns a 200 OK status. MessagingBindingAddress must be MessagingBinding.Address

Environment

  • Version used: 5.11.0
  • macos
@rtritean
Copy link

Having the same problem, all of our pipelines broke.

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