-
Notifications
You must be signed in to change notification settings - Fork 864
Open
Description
Is there an existing issue for this?
- I have searched the tracker for existing similar issues and I know that duplicates will be closed
Describe the Issue
When generating a collection from an OpenAPI definition, Postman fills parameters with random values even when valid examples are present. I suspect this happens because numeric examples are emitted as strings, but since the spec is autogenerated, I can’t change that. Maybe Postman could cast them instead?
This also causes Postman to constantly report schema updates because the random values keep changing, which gets annoying.
Note: The “Schema” option was suggested in past issues that I found (#10829 #9404), but it isn’t a suitable workaround and introduces its own problems.
Thanks for the attention!
Steps To Reproduce
- Create an API in Postman using an existing OpenAPI schema.
- Import or sync the autogenerated OpenAPI document so Postman builds the API schema.
- Go to Generate Collection from that API.
- In the generation settings, set Parameter generation to Example so parameters should use the examples defined in the OpenAPI spec.
- Complete the generation and open the resulting collection.
- Inspect any request that includes parameters with numeric examples.
Screenshots or Videos
This is my OpenAPI Spec:
Details
{
"openapi": "3.0.0",
"info": {
"title": "BFF",
"description": "BFF API description",
"version": "1.0",
"contact": {}
},
"servers": [],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "qms",
"description": ""
}
],
"paths": {
"/pets": {
"post": {
"description": "Criar um novo pet",
"operationId": "createPet",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "10",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "doggie",
"nullable": false
},
"category": {
"description": "",
"nullable": false,
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "1",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "Dogs",
"nullable": false
}
}
}
]
},
"photoUrls": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"nullable": false
}
}
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"nullable": false
}
},
"required": [
"name",
"photoUrls"
]
}
}
}
},
"responses": {
"default": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "10",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "doggie",
"nullable": false
},
"category": {
"description": "",
"nullable": false,
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "1",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "Dogs",
"nullable": false
}
}
}
]
},
"photoUrls": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"nullable": false
}
}
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"nullable": false
}
},
"required": [
"name",
"photoUrls"
]
}
}
}
}
},
"summary": "Criar Pet",
"tags": [
"pets"
]
}
},
"/pets/{petId}": {
"get": {
"description": "Obter um pet existente pelo ID",
"operationId": "getPetById",
"parameters": [
{
"name": "petId",
"required": true,
"in": "path",
"description": "ID of pet to return",
"schema": {
"nullable": false,
"example": "789",
"type": "number"
}
}
],
"responses": {
"default": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "10",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "doggie",
"nullable": false
},
"category": {
"description": "",
"nullable": false,
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "1",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "Dogs",
"nullable": false
}
}
}
]
},
"photoUrls": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"nullable": false
}
}
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"nullable": false
}
},
"required": [
"name",
"photoUrls"
]
}
}
}
}
},
"summary": "Obter Pet por ID",
"tags": [
"pets"
]
}
},
"/healthz/ready": {
"get": {
"description": "Esta rota verifica se a aplicação está pronta para receber tráfego. Se a aplicação não estiver pronta, o tráfego não deve ser encaminhado para ela.",
"operationId": "healthcheckReady",
"parameters": [],
"responses": {
"204": {
"description": ""
}
},
"summary": "Verifica se a aplicação está pronta",
"tags": [
"health"
]
}
},
"/healthz/live": {
"get": {
"description": "Esta rota verifica se a aplicação está viva. Se a aplicação não estiver viva, o container deve ser reiniciado.",
"operationId": "healthcheckLive",
"parameters": [],
"responses": {
"204": {
"description": ""
}
},
"summary": "Verifica se a aplicação está viva",
"tags": [
"health"
]
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"schemas": {
"Category": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "1",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "Dogs",
"nullable": false
}
}
},
"Tag": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"nullable": false
}
}
},
"Pet": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "10",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "doggie",
"nullable": false
},
"category": {
"description": "",
"nullable": false,
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"example": "1",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"example": "Dogs",
"nullable": false
}
}
}
]
},
"photoUrls": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"description": "",
"nullable": false,
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "",
"nullable": false,
"format": "int64"
},
"name": {
"type": "string",
"description": "",
"nullable": false
}
}
}
},
"status": {
"type": "string",
"description": "pet status in the store",
"nullable": false
}
},
"required": [
"name",
"photoUrls"
]
}
}
}
}
Operating System
macOS
Postman Version
11.75.5
Postman Platform
Postman App
User Account Type
Signed In User
Additional Context?
No response
Metadata
Metadata
Assignees
Labels
No labels