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

Importing Multi-example response #89

Closed
Br41n opened this issue Jul 10, 2019 · 12 comments · May be fixed by #350
Closed

Importing Multi-example response #89

Br41n opened this issue Jul 10, 2019 · 12 comments · May be fixed by #350
Labels

Comments

@Br41n
Copy link

Br41n commented Jul 10, 2019

when i try to import a multi-example response, is only importing the first response.

OPENAPI 3.0.0 EXAMPLE

openapi: "3.0.0"

info:
  title: ExampleApi
  description: Example Api
  version: 1.0.0
  contact:
    name: support
    email: [email protected]

servers:
  - url: http://example.com
    description: example server

paths:
  /users:
    post:
      description: Create User
      summary: Create User
      responses:
        '201':  
          description: Return a User Object
          content: 
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: integer
                  name:
                    type: string
              examples:
                John-Ok-Example:
                  summary: Success create of John User
                  description: Success create of John User
                  value:
                    id: 1
                    name: John Doe
                Jane-Ok-Example:
                  summary: Success create of Jane User
                  description: Success create of Jane User
                  value:
                    id: 2
                    name: Jane Doe

Postman Versión

image

Postman Collection

image

Postman Example

image

Referencia

See: /lib/utils.js
function getExampleData

@abhijitkane abhijitkane added the bug Something isn't working label Jul 11, 2019
@daithiscully
Copy link

This would be a very useful improvement for us too! Any update on it?

@ProBeta1
Copy link

May I try to slay this bug @umeshp7 ?

@umeshp7
Copy link
Contributor

umeshp7 commented Mar 19, 2020

Go ahead @ProBeta1. Should I assign this to you?

@ProBeta1
Copy link

Okay @umeshp7 :)

@ProBeta1
Copy link

Was bit busy with the gsoc proposal work, hence the delay .
So here is what I think is the cause of bug : getExampleData() , this function is made to return only first example from the input map , because it is used by the function convertToPmBodyData to generate postman data. So should I just make the getExampleData() function return the entire Object @umeshp7 ?
Or something else is causing this issue ?

@codeninja55
Copy link

+1

Has this been fixed?

@mdaj06
Copy link

mdaj06 commented Oct 15, 2020

@umeshp7 could i take this up?

@Clem23
Copy link

Clem23 commented Jan 29, 2021

Hi,
Any update on this ?
It would be really useful to us too !

@ambition-consulting
Copy link

ambition-consulting commented Feb 27, 2021

This feature is really important for any serious user of APIs. Who can live with just one example?
@umeshp7 @ProBeta1 @mdaj06 Any update? I would love to complete my CI Pipeline with Quarkus -> OpenApi-Export -> PostMan Import -> NewMan for automated REST testing.

@pcgamer1
Copy link
Contributor

@VShingala @umeshp7 can I work on this?

@alno74d
Copy link

alno74d commented Nov 11, 2022

Duplicate of #425
Is there any update?

@VShingala
Copy link
Member

We've added support for this with latest Postman App v10.19 and this module. Please give it a try and let us know your feedback.

Here's brief overview of how this will work.

  1. If request body and response body both have an example with the same example key, we'll create a separate example with matching request and response body.
  2. If request body and response body example key doesn't match, we'll try to create a matching based on the order or mention of these examples. i.e. 1st example will contain 1st request body example and 1st response body example in it.
  3. If after above, we have request or response bodies without matching, we'll use the existing behavior of using the first example. (Note that, we'll create one separate example for each example for both the request body and response body even if matches are not found)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.