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

json.canParse = false, but is validating. #152

Open
brunopenso opened this issue Sep 25, 2020 · 0 comments
Open

json.canParse = false, but is validating. #152

brunopenso opened this issue Sep 25, 2020 · 0 comments

Comments

@brunopenso
Copy link

brunopenso commented Sep 25, 2020

Hi Guys,

I'm using the validator but I would like to avoid json validation, so I set my validator to this:

  const obj = await SwaggerParser.validate(filePath, {
    parse: {
      json: {
        canParse: false,
        order: 1000,
        allowEmpty: false
      },
      yaml: {
        allowEmpty: false, // Don't allow empty YAML files
        canParse: true,
        order: 0
      },
      text: {
        canParse: false
      }
    },
    resolve: {
      external: true
    },
    validate: {
      schema: true,
      spec: false
    }
  })

When I execute this code with a JSON file the file got validated. Reading the documentation I understood that I can disable JSON validation, so I would expect and error.

Am I right? Maybe, Am I doing something wrong?

Versions:
"@apidevtools/swagger-parser": "^10.0.1"
Node: v12.18.3

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

No branches or pull requests

1 participant