Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Dredd error: Cannot assign to read only property 'parent' of object '#<ArrayElement>' #1762

Closed
Nitwel opened this issue May 30, 2020 · 1 comment

Comments

@Nitwel
Copy link

Nitwel commented May 30, 2020

Describe the bug
When I try to run dredd, I just get this error which does not say much about whats wrong here.

Full error $ dredd docs/openapi.yaml https://demo.directus.io/admin --loglevel=debug 2020-05-30T08:02:37.491Z - debug: Loading configuration file: ./dredd.yml 2020-05-30T08:02:37.493Z - debug: Dredd version: 13.1.1 2020-05-30T08:02:37.493Z - debug: Node.js version: v12.14.0 2020-05-30T08:02:37.493Z - debug: Node.js environment: node=12.14.0, v8=7.7.299.13-node.16, uv=1.33.1, zlib=1.2.11, brotli=1.0.7, ares=1.15.0, modules=72, nghttp2=1.39.2, napi=5, llhttp=1.1.4, http_parser=2.8.0, openssl=1.1.1d, cldr=35.1, icu=64.2, tz=2019c, unicode=12.1 2020-05-30T08:02:37.494Z - debug: System version: Windows_NT 10.0.18363 x64 2020-05-30T08:02:37.513Z - debug: npm version: [object Object] 2020-05-30T08:02:37.513Z - debug: Configuration: {"_":["docs/openapi.yaml"],"color":true,"loglevel":"debug","l":"debug","dry-run":null,"y":null,"hookfiles":null,"f":null,"language":"nodejs","a":"nodejs","require":null,"server":"https://demo.directus.io/admin","g":null,"server-wait":3,"init":false,"i":false,"custom":{"cwd":"C:\\Users\\nitwe\\Documents\\Programmieren\\Directus\\SDK-Generator","argv":["docs/openapi.yaml","https://demo.directus.io/admin","--loglevel=debug"]},"j":[],"names":false,"n":false,"only":[],"x":[],"reporter":[],"r":[],"output":[],"o":[],"header":[],"h":[],"sorted":false,"s":false,"user":null,"u":null,"inline-errors":false,"e":false,"details":false,"d":false,"method":[],"m":[],"path":["docs/openapi.yaml","docs/openapi.yaml"],"p":["docs/openapi.yaml","docs/openapi.yaml"],"hooks-worker-timeout":5000,"hooks-worker-connect-timeout":1500,"hooks-worker-connect-retry":500,"hooks-worker-after-connect-wait":100,"hooks-worker-term-timeout":5000,"hooks-worker-term-retry":500,"hooks-worker-handler-host":"127.0.0.1","hooks-worker-handler-port":61321,"config":"./dredd.yml","$0":"C:\\Program Files\\nodejs\\node.exe C:\\Users\\nitwe\\AppData\\Roaming\\npm\\node_modules\\dredd\\bin\\dredd"} 2020-05-30T08:02:37.517Z - debug: No backend server process specified, starting testing at once 2020-05-30T08:02:37.517Z - debug: Running Dredd instance. 2020-05-30T08:02:37.517Z - debug: Resolving --require 2020-05-30T08:02:37.518Z - debug: Configuring reporters 2020-05-30T08:02:37.518Z - debug: Using 'base' reporter. 2020-05-30T08:02:37.519Z - debug: Configuring reporters: [] 2020-05-30T08:02:37.520Z - debug: Using 'cli' reporter. 2020-05-30T08:02:37.520Z - debug: Preparing API description documents 2020-05-30T08:02:37.520Z - debug: Resolving locations of API description documents 2020-05-30T08:02:37.523Z - debug: Reading API description documents 2020-05-30T08:02:37.532Z - debug: Parsing API description documents 2020-05-30T08:02:37.664Z - debug: Compiling HTTP transactions from API description documents 2020-05-30T08:02:37.665Z - debug: Dredd instance run finished. 2020-05-30T08:02:37.665Z - error: Unable to compile HTTP transactions from API description document 'C:\Users\nitwe\Documents\Programmieren\Directus\SDK-Generator\docs\openapi.yaml': Cannot assign to read only property 'parent' of object '#': Cannot assign to read only property 'parent' of object '#' 2020-05-30T08:02:37.665Z - debug: Using native process.exit() method to terminate the Dredd process with status '1'. 2020-05-30T08:02:37.665Z - debug: No backend server process to terminate.

To Reproduce
Here's the whole Project: https://github.com/directus/SDK-Generator

Expected behavior
It should work?

What is in your dredd.yml?

I dont use one. The command is in the first line of the spoiler

What's your dredd --version output?

I'm using dredd 13.1.1

Does dredd --loglevel=debug uncover something?
No, just look at it. :/

@kylef
Copy link
Member

kylef commented Jun 23, 2020

The error being thrown is due to a bug in our OpenAPI 3 parser, I've issued a fix at apiaryio/api-elements.js#502. Upon using the fixed OpenAPI 3 parser, the document would expose some unclear error messages during validation due to the use of referencing in components which is not yet supported:

components:
  schemas:
    UserAlias:
      $ref: '#/components/schemas/User'
    User:
      type: object

I've added support for using references at the root of a re-usable component in apiaryio/api-elements.js#503.

Afterwards, the document still won't with Dredd. That's because Dredd is yet to support referencing external file references. At the moment all references must be to the components section. Support for referencing external files is a much larger feature which is tracked by #676.

kylef added a commit to apiaryio/api-elements.js that referenced this issue Jun 24, 2020
@kylef kylef closed this as completed in 05c083f Jun 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants