mpaSwisscom
(Pascal Mengelt)
1
I want to import an Open API definition, that sets its path values with an example. This works for the body perfectly.
Here is the Open API definition:
parameters:
- name: processDefinitionKey
in: path
schema:
type: string
example: 'myProcessDefinitionKey'
After importing it:
I would expect:
It works if I add the example to the schema or use the default of the schema:
parameters:
- name: processDefinitionKey
in: path
schema:
type: string
example: 'myProcessDefinitionKey'
or
parameters:
- name: processDefinitionKey
in: path
schema:
type: string
default: 'myProcessDefinitionKey'
But this is not supported by my framework to create the Open API definition.
Is there a way to achieve this in my scenario?
you can validate if the api is valid at :
https://editor.swagger.io/
And this is indeed a valid API and is working fine swagger , i think its a issue with Postman:
openapi: 3.0.0
info:
version: '1'
title: sd
servers:
- url: 'http://localhost:3000'
paths:
/{processDefinitionKey}/user:
get:
summary: 'Sample endpoint: Returns details about a particular user'
operationId: listUser
tags:
- user
parameters:
- name: id
in: query
description: ID of the user
required: true
schema:
type: string
format: int32
example: somestring
- name: processDefinitionKey
in: path
description: ID of the user
required: true
schema:
type: integer
format: int32
example: 45
responses:
'200':
description: 'Sample response: Details about a user by ID'
headers:
x-next:
description: A link to the next page of responses
schema:
type: string
content:
application/json:
schema:
$ref: '#/components/schemas/User'
default:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
components:
schemas:
User:
type: object
required:
- id
- name
properties:
id:
type: integer
format: int64
name:
type: string
tag:
type: string
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
format: int32
message:
type: string
mpaSwisscom
(Pascal Mengelt)
4
@praveendvd thanks for the response and raising an issue.