Skip to content

fast-uri still not compatible for AJV #85

@jasoniangreen

Description

@jasoniangreen

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

2.4.0

Plugin version

No response

Node.js version

18.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

14.5

Description

Hi there, I know you're all keen to get fast-uri compatible to be used as default in AJV. I setup the following test with the latest version and it still fails while uri-js passes.

const AJV = require('ajv');
const fastUri = require('fast-uri');
const ajv = new AJV({
  uriResolver: fastUri // comment this line to see it works with uri-js
});

const schema = {
  $ref: "#/definitions/Record%3Cstring%2CPerson%3E",
  definitions: {
    Person: {
      type: "object",
      properties: {
        firstName: {
          type: "string",
        },
      },
    },
    "Record<string,Person>": {
      type: "object",
      additionalProperties: {
        $ref: "#/definitions/Person",
      },
    },
  },
};

const data = {
  joe: {
    firstName: "Joe",
  },
};

const validate = ajv.compile(schema); // throws with fast-uri
console.log(validate(data));

Link to code that reproduces the bug

No response

Expected Behavior

Should log true with fast-uri just as it does with uri-js which can you see if you comment out the line that adds fast-uri.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions