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

"schema type not provided" in body with OpenAPI 3.0 #75

Closed
wabiloo opened this issue Jun 5, 2019 · 1 comment
Closed

"schema type not provided" in body with OpenAPI 3.0 #75

wabiloo opened this issue Jun 5, 2019 · 1 comment

Comments

@wabiloo
Copy link

wabiloo commented Jun 5, 2019

This is a follow-up on #27 as I still found that the imported file would not convert and would result in a string "schema type not provided" when importing in Postman 7.1.1.

Example of file that fails to import correctly is openapi-short.json.txt

I am assuming that that version of Postman 7.1.1 does use openapi-to-postman v0.0.14. I've gone through the code by trying to do the conversion manually. It does appear that the deref.js script (in charge of converting $ref references, which are used heavily in this openapi spec) is not used at all if schemaFaker is set to false.

If I set schemaFaker to true, I then get multiple errors:

Error faking a schema. Not faking this schema. Schema: {
  type: 'object',
  properties: {
    id: {
      type: 'string',
      readOnly: true,
      description: 'Id of the resource',
      example: 'cb90b80c-8867-4e3b-8479-174aa2843f62',
      default: '<string>'
    },
    mode: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    host: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    port: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    path: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    latency: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    passphrase: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    keyLength: {
      value: '<Error: Too many levels of nesting to fake this schema>'
    },
    backupSrtInputs: {
      title: 'BackupSrtInputs',
      required: [Array],
      properties: [Object],
      type: 'object'
    }
  },
  description: undefined
} Error Error: unable dereference circular structures
    at module.exports (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1450:13)
    at copy (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1462:21)
    at /Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1471:9
    at Array.forEach (<anonymous>)
    at module.exports (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1470:24)
    at copy (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1462:21)
    at /Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1471:9
    at Array.forEach (<anonymous>)
    at module.exports (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1470:24)
    at copy (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:1462:21)
Error faking a schema. Not faking this schema. Schema: {
  type: 'object',
  properties: {
    id: {
      type: 'string',
      readOnly: true,
      description: 'Id of the resource',
      example: 'cb90b80c-8867-4e3b-8479-174aa2843f62',
      default: '<string>'
    },
    height: {
      type: 'integer',
      description: 'Height of the thumbnail',
      example: 320,
      default: '<integer>'
    },
    pattern: {
      type: 'string',
      description: ' Pattern which describes the thumbnail filenames. For example ' +
        'with thumbnail-%number%.png as pattern and 3 positions: ' +
        'thumbnail-3_0.png, thumbnail-5_0.png and thumbnail-25_5.png. ' +
        '(The number represents the position in the source video in ' +
        'seconds, in the previous example the first filename represents ' +
        'the thumbnail at 3s, the second one at 5s and the third one at ' +
        '25.5s)',
      example: 'thumbnail-%number%.png',
      default: '<string>'
    },
    positions: {
      type: 'array',
      items: [Object],
      description: 'Position in the unit where the thumbnail should be created from.',
      maxItems: 2,
      minItems: 2
    },
    outputs: { type: 'array', items: [Object], maxItems: 2, minItems: 2 },
    unit: {
      title: 'ThumbnailUnit',
      type: 'string',
      default: 'SECONDS',
      enum: [Array],
      'x-enum-elements': [Array]
    }
  },
  description: undefined
} Error Error: Expected a regexp or string in /
    at run (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:24728:21)
    at jsf (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/assets/json-schema-faker.js:24771:14)
    at safeSchemaFaker (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:80:12)
    at Object.convertToPmBodyData (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:725:20)
    at Object.convertToPmBody (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:1102:23)
    at Object.convertRequestToItem (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:1384:21)
    at Object.convertChildToItemGroup (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:515:17)
    at Object.convertChildToItemGroup (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:483:18)
    at Object.convertChildToItemGroup (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:492:20)
    at Object.convertChildToItemGroup (/Users/fabre.lambeau/openapi/Tools/openapi-to-postman-converter/node_modules/openapi-to-postmanv2/lib/util.js:492:20)
@abhijitkane
Copy link
Member

@wabiloo We've updated the OpenAPI importer version in Postman 7.2.1. I'm able to import the linked text file. Can you update Postman and check if it works for you?

I wasn't able to reproduce the errors running via the command-line. Can you provide a screenshot of the exact command/script you're running?

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

No branches or pull requests

2 participants