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

Retain schema type in variables from openAPI #711

Open
JaredAAT opened this issue May 2, 2023 · 2 comments
Open

Retain schema type in variables from openAPI #711

JaredAAT opened this issue May 2, 2023 · 2 comments
Labels
awaiting-response Awaiting response from the User

Comments

@JaredAAT
Copy link

JaredAAT commented May 2, 2023

Given an OpenAPI schema of:

{
	"openapi": "3.0.3",
	"info": {
		"title": "Document Generation",
		"description": "Document Generation API",
		"version": "0.0.3"
	},
	"components": {
		"schemas": {
			"ErrorResponse": {
				"type": "object",
				"properties": {
					"message": {
						"type": "string"
					},
					"errors": {
						"type": "object"
					}
				}
			},
			"contactId": {
				"type": "string",
				"format": "uuid"
			},
			"pdfResponse": {
				"type": "string",
				"format": "binary"
			},
			"programmeId": {
				"type": "integer"
			}
		}
	},
	"paths": {
		"/pdf/soa/{contactId}/{programmeId}": {
			"get": {
				"summary": "Generates a Statement Of Achievement PDF",
				"description": "> **Produces a Statement Of Achievement PDF for a particular contact and programme**.\n\n### Authorization\n\n\nThis API endpoint is protected by Lambda Authorizer `Authenticated`\n\n\nThis API endpoint implements following Authorization types. Authorization is granted if one of the listed types is satisfied.\n* `- Resource owner`\n* `- Connected by programme registration`\n* `- Connected by organisation`\n",
				"operationId": "APIDocumentGeneration-uat-unitresultpdf",
				"parameters": [
					{
						"name": "contactId",
						"in": "path",
						"description": "The Contact ID of the contact a Statement Of Achievement PDF should be generated for",
						"required": true,
						"schema": {
							"$ref": "#/components/schemas/contactId"
						}
					},
					{
						"name": "programmeId",
						"in": "path",
						"description": "The Programme ID of the Statement Of Achievement PDF should be generated for",
						"required": true,
						"schema": {
							"$ref": "#/components/schemas/programmeId"
						}
					}
				],
				"tags": ["Document Generation"],
				"responses": {
					"200": {
						"description": "The Statement Of Achievement PDF",
						"content": {
							"application/pdf": {
								"schema": {
									"$ref": "#/components/schemas/pdfResponse"
								}
							}
						}
					},
					"400": {
						"description": "An error message",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					},
					"403": {
						"description": "Forbidden response",
						"content": {
							"application/json": {
								"schema": {
									"$ref": "#/components/schemas/ErrorResponse"
								}
							}
						}
					}
				}
			}
		}
	},
	"servers": [
		{
			"url": "/document-generation",
			"description": "The base URL"
		}
	],
	"tags": [
		{
			"name": "Document Generation",
			"description": "v0.0.3 - Libs API v8.6.12\n"
		}
	],
	"externalDocs": {
		"description": "Postman Collection V2"
	}
}

Where the path parameter programmeId has a schema type of "integer", the generated collection sets the variable as:

{
                                    "disabled": false,
                                    "type": "any",
                                    "value": "<integer>",
                                    "key": "programmeId",
                                    "description": "(Required) The Programme ID of the Statement Of Achievement PDF should be generated for"
                                }

It'd be good if the type could be retained as "integer" in the type field on the generated variable object, that would be great!

@VShingala
Copy link
Member

@JaredAAT Thanks for reporting your issue. I wanted to understand your use-case a bit more here, as this type field is specific to Postman collection variable, which can only be certain values as mentioned here. AFAIK, Postman app doesn't specify this type in UI itself. So could you explain your use-case around this in more detail as that would help us a lot.

image

@VShingala VShingala added the awaiting-response Awaiting response from the User label May 12, 2023
@JaredAAT
Copy link
Author

Hey @VShingala So it comes to when we're programmatically manipulating postman collections. Once we've imported a schema and postman has generated its own variables and structure, it loses type knowledge. Whilst we appreciate that an int won't be a string, it'd be useful to retain the type knowledge for future manipulations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-response Awaiting response from the User
Projects
None yet
Development

No branches or pull requests

2 participants