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

'validate is not a function' error #1643

Open
dlapanik opened this issue Jun 6, 2022 · 1 comment
Open

'validate is not a function' error #1643

dlapanik opened this issue Jun 6, 2022 · 1 comment

Comments

@dlapanik
Copy link

dlapanik commented Jun 6, 2022

Describe the bug
Getting error 'validate is not a function' when try to create service instance if for SFPlan definition JSON Schema draft-07 was used.

To Reproduce
Steps to reproduce the behavior:

  1. Define SFPlan with "$schema": "http://json-schema.org/draft-07/schema#"
  schemas:
    service_instance:
      create:
        parameters:
          "$schema": "http://json-schema.org/draft-07/schema#"
          title: createServiceInstance
          type: object
          additionalProperties: false
          _show_form_view: true
          properties:
            backend:
              type: string
  1. try to create service instance

Expected behavior
As soon as you are using https://ajv.js.org for JSON validation I expect that drafts 04, 06, 07, 2019-09 and 2020-12 are supported.

If by some reason you support only draft-04,-06 I expect do not see runtime error but appropriate message (better during applying SFPlan and not when somebody tries to create service instance)

Additional context
Error raised from line 243.

Bug was introduced by eb5a282.

If you follow method validateSchemaForRequest - there are branches only for schema equal draft-04,-06 and "". So if schema defined as draft-07 and code comes to line 243 validate has undefined value

@anoopjb
Copy link
Contributor

anoopjb commented Aug 11, 2022

Sorry. we dropped support for draft-07 in latest version of interoperator.

Previously we were using an outdated version of ajv library. The older version of ajv uses draft-06 and draft-04 to validate draft-07. So I feel if you use the draft06 schema then the validation should happen fine. You may try this if it is easy.

The latest ajv brought in dedicated support for draft-07. We wanted to upgrade the ajv but did not had enough capacity to test with draft-07.

Thanks a lot for catching this bug. We love to support draft-07 but not finding time to work on it.

BTW, We are also open to contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Waiting for Changes | Open for Contributions
Development

No branches or pull requests

2 participants