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

Support example responses in generator #77

Closed
jlengrand opened this issue Feb 26, 2024 · 3 comments
Closed

Support example responses in generator #77

jlengrand opened this issue Feb 26, 2024 · 3 comments
Assignees

Comments

@jlengrand
Copy link
Contributor

jlengrand commented Feb 26, 2024

Postman supports example responses to illustrate the result of queries without having to hit an actual server.

#63 adds support for those examples.

What still needs to be supported :

image
  • No support for multiple example responses at the moment.
  • Better unit testing is necessary
  • Responses contain the original request information (see comment below) (works now, but generated headers and auth info are missing. Asked postman team for more info).
@jlengrand
Copy link
Contributor Author

I also note that when I look at already existing and validated postman collections, they seem to be repeating information about the request as part of the response, which allows to show the actual request as part of the response.

image

This isn't the case for ours at the moment

image

This is how the response looks like in this case :

					"response": [
						{
							"name": "successful operation",
							"originalRequest": {
								"method": "POST",
								"header": [
									{
										"description": "Added as a part of security scheme: apikey",
										"key": "x-api-key",
										"value": "<API Key>"
									},
									{
										"key": "Accept",
										"value": "application/json"
									}
								],
								"body": {
									"mode": "raw",
									"raw": "{\n  \"From\": \"2020-12-31T22:59:59+00:00\",\n  \"To\": \"2020-12-31T22:59:59+00:00\",\n  \"Tags\": [\n    \"<string>\",\n    \"<string>\"\n  ]\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "{{baseUrl}}/calculate/jobScheduler",
									"host": [
										"{{baseUrl}}"
									],
									"path": [
										"calculate",
										"jobScheduler"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Content-Type",
									"value": "application/json"
								}
							],
							"cookie": [],
							"body": "[\n  {\n    \"JobId\": \"voluptate minim aliquip veniam\",\n    \"Count\": 65382380,\n    \"Items\": \"aliqua aute\"\n  },\n  {\n    \"JobId\": \"et sunt est sit\",\n    \"Count\": -71167171,\n    \"Items\": \"voluptate\"\n  }\n]"
						}
					]

@jlengrand
Copy link
Contributor Author

@jlengrand
Copy link
Contributor Author

jlengrand commented Feb 28, 2024

  • Add response headers (added ugly postman flag instead)

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