oas3-api-snippet-enricher icon indicating copy to clipboard operation
oas3-api-snippet-enricher copied to clipboard

TypeError: Cannot create property 'x-codeSamples' on string 'paths/pets.yaml'

Open timganter opened this issue 2 years ago • 0 comments

👋 Hello!

Trying this out for the first time. I rearranged the expanded petstore example to have...

paths:
  /pets:
    $ref: paths/pets.yaml

Here is the directory for the rearranged petstore example.

👉 petstore.zip

When I run ./node_modules/.bin/snippet-enricher-cli --input=petstore/openapi.yaml > openapi-with-examples.json

I open up openapi-with-examples.json and it contains the following...

TypeError: Cannot create property 'x-codeSamples' on string 'paths/pets.yaml'
    at enrichSchema ({MY_LOCAL_PATH}/node_modules/snippet-enricher-cli/index.js:19:48)
    at Object.<anonymous> ({MY_LOCAL_PATH}/node_modules/snippet-enricher-cli/index.js:40:12)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> ({MY_LOCAL_PATH}/node_modules/snippet-enricher-cli/bin/snippet-enricher-cli:2:1)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)

🤔 Does this not work on refs? Does the openapi.yaml need to be a single file?

timganter avatar Mar 13 '22 17:03 timganter