prism
prism copied to clipboard
Support "encoding" keyword - Requests to Mocked API on postman results 422 error
Describe Issue
I'm mocking a API that receives as input a x-www-form-urlencoded containing a key called request and a json as value (yaml below for reference).
openapi: "3.0.0"
info:
description: "Example Documentation"
version: "1.0.0"
title: "Example"
servers:
- url: http://myurl.com
tags:
- name: "example"
description: "example"
paths:
/json:
post:
tags:
- example
summary: "this is my example"
description: ""
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
request:
$ref: "#/components/schemas/request"
encoding:
request:
contentType: application/json
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: object
properties:
responseCode:
type: integer
example: 0
description:
type: string
example: "OK"
url:
type: string
example: "http://myurl.com/response"
components:
schemas:
request:
type: object
required:
- amount
- merchant_id
properties:
amount:
type: integer
example: 100
merchant_id:
type: string
example: "merchant_id"
I'm running Prism in a docker container and running the yaml file to generate the mock.
The docker command i'm using is as below:
docker run --init --rm -v ${PWD}:/tmp -p 4010:4010 stoplight/prism mock -h 0.0.0.0 "/tmp/example.yaml"
Yet, when I make a request in postman at /json it returns me 422 error, as seen in the picture:

Expected Behavior
I Expect Prism to give me the 200 code output with the response examples
Is this a problem from my setup or Prism can't handle this input format?
Correct, we do not support the encoding keyword just yet, that's a power user thing you don't often see in the wild.
Fancy rolling your sleeves up and giving us a hand? It looks like there's two of you interested, but we've got more features on our roadmap than we have developers to write them.
Hey team, do you have plans for adding support for application/x-www-form-urlencoded request bodies anytime soon?
Removing points to re-groom and discuss with team.
Hey team! Please add your planning poker estimate with ZenHub @Amjcraft @lukasz-kuzynski-11sigma @radzserg @rainum
- OASv3.1 - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#encoding-object
- OASv3.0 - https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encoding-object
- OASv2.0 - not a thing.
Hey team! Please add your planning poker estimate with ZenHub @Amjcraft @daniel-white @EdVinyard @jasonmgillhub @rainum