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

Error message has no line number or hint #116

Open
AlexHolly opened this issue Jun 6, 2019 · 1 comment · May be fixed by #175
Open

Error message has no line number or hint #116

AlexHolly opened this issue Jun 6, 2019 · 1 comment · May be fixed by #175

Comments

@AlexHolly
Copy link

Is there a way to show which key is wrong, in the following example line 2 "should not have additionalProperty: inf" or any line number would be good.

Tested with: https://apidevtools.org/swagger-parser/online/

API

openapi: 3.0.0
inf:
  description: Example Api
  version: 1.0.0
  title: Mini Example
servers:
  - url: 'https://petstore.swagger.io/v2'
paths: {}
[object Object] is not a valid Openapi API definition

Error: [object Object] is not a valid Openapi API definition
    at https://apidevtools.org/swagger-parser/online/js/bundle.js:1143:27

SyntaxError: [object Object] is not a valid Openapi API definition
    at Function.syntax (https://apidevtools.org/swagger-parser/dist/swagger-parser.min.js:25:95937)
    at https://apidevtools.org/swagger-parser/dist/swagger-parser.min.js:9:2484
@AlexHolly
Copy link
Author

AlexHolly commented Jul 24, 2019

Removing these lines helps.

if (schema.swagger === undefined || schema.info === undefined || schema.paths === undefined) {
throw ono.syntax(`${args.path || args.schema} is not a valid Swagger API definition`);
}

if (schema.openapi === undefined || schema.info === undefined || schema.paths === undefined) {
throw ono.syntax(`${args.path || args.schema} is not a valid Openapi API definition`);
}

Also need to add some checks for info
schema.info &&

else if (typeof schema.info.version === "number") {

else if (typeof schema.info.version === "number") {

AlexHolly added a commit to SoftBugs/swagger-parser that referenced this issue Oct 25, 2019
@AlexHolly AlexHolly linked a pull request Jun 26, 2021 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant