docusaurus-openapi-docs icon indicating copy to clipboard operation
docusaurus-openapi-docs copied to clipboard

Exception is thrown on using composition patter in schema

Open ifropc opened this issue 2 years ago • 3 comments
trafficstars

Describe the bug

When using composition patter in the object schema (allOf), exception is thrown.

Error while resolving allOf schema:  Error: Could not resolve values for path:"enum". They are probably incompatible. Values:
[
  "incomplete",
  "completed",
  "refunded",
  "expired",
  "error",
  "pending_stellar",
  "pending_external"
]
[
  "pending_sender",
  "pending_receiver",
  "pending_transaction_info_update",
  "pending_customer_info_update"
]
    at throwIncompatible (<project>/node_modules/json-schema-merge-allof/src/index.js:95:9)
    at <project>/node_modules/json-schema-merge-allof/src/index.js:320:11
    at Array.forEach (<anonymous>)
    at mergeSchemas (<project>/node_modules/json-schema-merge-allof/src/index.js:301:13)
    at merger (<project>/node_modules/json-schema-merge-allof/src/index.js:334:18)
    at Object.resolveAllOf (<project>/node_modules/@paloaltonetworks/openapi-to-postmanv2/lib/deref.js:102:14)
    at Object.resolveRefs (<project>/node_modules/@paloaltonetworks/openapi-to-postmanv2/lib/deref.js:179:19)
    at <project>/node_modules/@paloaltonetworks/openapi-to-postmanv2/lib/deref.js:104:23
    at Array.map (<anonymous>)
    at Object.resolveAllOf (<project>/node_modules/@paloaltonetworks/openapi-to-postmanv2/lib/deref.js:103:26)

As a result, error code 1 is returned

Expected behavior

No error

Current behavior

Error

Possible solution

N/A

Steps to reproduce

Clone project in the correct branch and run yarn api:gen

Screenshots

ReDoc

image

Context

See #574

Your Environment

Branch OpenAPI yaml file Package.json Working ReDoc link

ifropc avatar May 10 '23 22:05 ifropc

Hi @Ifropc, it appears that @paloaltonetworks/openapi-to-postmanv2 is throwing the exception. Since it's a forked package/library, my thought was that we should try to parse your OpenAPI spec using the original library/CLI:

https://github.com/postmanlabs/openapi-to-postman

It could also be helpful to scrub their issues/PRs to see if this behavior has been already reported or patched.

sserrata avatar May 11 '23 13:05 sserrata

It looks like it's affected by https://github.com/postmanlabs/openapi-to-postman/issues/417 FYI: I wrote that the page page doesn't render the content correctly at first, but in reality nothing is generated (code 1 is returned) I updated description. Out of curiosity, why is this library used?

ifropc avatar May 12 '23 23:05 ifropc

Out of curiosity, why is this library used?

It's used for generating the code snippets.

sserrata avatar May 15 '23 15:05 sserrata