ErikWittern / openapi-snippet

Generates code snippets for given Swagger / Open API documents
MIT License
116 stars 67 forks source link

Getting 'HARError: validation failed' #18

Closed jdillard closed 2 years ago

jdillard commented 5 years ago

I can run v0.5.1 successfully on some OpenAPI 3 files I have, but v0.6.0 gives me the following error:

/usr/local/lib/node_modules/swagger-snippet/node_modules/httpsnippet/src/index.js:46
        throw err
        ^
HARError: validation failed

I'm not sure where to start looking, but if you have an idea I can give it a shot.

ErikWittern commented 5 years ago

Hm, OpenAPI 3 support only landed in v0.6.0 thanks to #17 , right? So how did things work in v0.5.1? I can try to help investigate, but would need the OpenAPI Spec you are using.

ameza13 commented 1 year ago

@ErikWittern @jdillard how did you solve this error? I'm also getting it:

[Error [HARError]: validation failed] {
  errors: [
    {
      keyword: 'format',
      dataPath: '.url',
      schemaPath: '#/properties/url/format',
      params: [Object],
      message: 'should match format "uri"'
    }
  ]
}

The file I'm using as input is attached in the zip below (file name is GDPS_REST_API_V4R6GM-4.6.0.json).

To test code snippets generation I created my_test.js (also part of the zip) based on your test.jsscript. It works well with your petstore_oas.json file.

Archive.zip

jdillard commented 1 year ago

I no longer work on or have access to that project so not sure what exactly I was doing at the time or if my assessment was actually accurate.