openapi-to-postman icon indicating copy to clipboard operation
openapi-to-postman copied to clipboard

Inconsistent example/body text being produced for json schema

Open rpcesar opened this issue 3 years ago • 3 comments

Issue

I am getting what I can best describe as inconsistent ipsum text in the body (example) of many example entries. I have selected request/example ParametersResolution to schema, so I expect all variables will be described in the form "" or "". Instead, in many fields in random places I am getting ipsum text. This problem occurs on the postman application as well.

Eg:

"body": "{\n \"Status\": \"Duis laboris tempor\",\n \"Results\": [\n  {\n   \"Match\": \"<string>\",\n   \"Record\": {\n    \"SubjectType\": \"in cupidatat ea\",\n    \"SubjectId\": \"<string>\"\n   }\n  },\n  {\n   \"Match\": \"<string>\",\n   \"Record\": {\n    \"SubjectType\": \"dolore commodo exercitat\",\n    \"SubjectId\": \"<string>\"\n   }\n  }\n ]\n}",

Example Provided:

example contains 2 files, the openapi source and the postman output. It was generated with the following cli command:

openapi2postmanv2 -s dist/openapi.json -o dist/postman.json -p -O requestParametersResolution=schema,exampleParametersResolution=schema

dist.zip

rpcesar avatar Aug 24 '21 00:08 rpcesar

I think I'm seeing this same issue in documentation generated from an imported OpenAPI schema.

I have example properties on individual fields, which sometimes display in the generated documentation, and sometimes do not.

In these screenshots, only the email field is populated using my specified example key.

I do not have any request examples specified for this endpoint.

Screenshot 2021-12-21 at 11 43 02 Screenshot 2021-12-21 at 11 43 33

ghost avatar Dec 21 '21 11:12 ghost

having the same issue as @rpcesar "ipsum" text is replaced everywhere in the body of the request

a-dawg avatar Jan 07 '22 16:01 a-dawg

Same here...

homemdasneves avatar Oct 01 '22 09:10 homemdasneves

@rpcesar Thanks for reporting the issue. It seems the issue is due to module not correctly understanding schemas with only enum mentioned (i.e. without "type": "string" mentioned in them). We'll start working on a fix for this and let you know once fixed in the upcoming weeks.

As for the issue reported by deleted user ghost, It should be working as expected. I've verified the same and below is request body that gets generated.

image

@a-dawg @homemdasneves It'd also help us in getting more issues fixed if not the same as this if you could share a sample spec where you have this issue as it could happen due to multiple reason. i.e. If the mentioned example is not valid according to corresponding schema then we generate value overriding the example.

VShingala avatar Jan 13 '23 13:01 VShingala