-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
generated code is wrong with that schema #268
Comments
Removing |
It is initialized with
|
I'm running into the same issue. The following is the generated code containing the syntax error beautified: if (typeof {
"str": "data4"
} == "string" && {
"str": "data"
} !== undefined) {
data4 = {
"str": "func4",
"prefix": "func",
"value": {
"code": {
"_items": ["require(\"ajv-keywords/dist/definitions/transform\").transform", ".toLowerCase", ""]
}
},
"scopePath": {
"_items": [".", {
"str": "func"
}, "[", 2, "]"]
}
}({
"str": "func5",
"prefix": "func",
"value": {
"code": {
"_items": ["require(\"ajv-keywords/dist/definitions/transform\").transform", ".trim", ""]
}
},
"scopePath": {
"_items": [".", {
"str": "func"
}, "[", 3, "]"]
}
}({
"str": "data4"
})); {
"str": "data" // Syntax error here: Unexpected ":", expected
} [{
"_items": ["", "\"email\"", ""]semicolon
}] = data4;
} I can't really make sense of this code – no idea what these free-floating objects are supposed to do. The syntax error happens where an object literal is defined but because there is no I'm using |
I have some issue. Do you have any ideas for solving this? |
I am seeing the same issue with Removing |
I have also tried returning to Has transform worked at all with ajv 8? |
I believe I have solved it on my end. The issue for me has been that I'm using ajv and ajv-keywords inside a monorepo, where multiple packages are using ajv. Basically the issue has been that the "ajv" package was installed multiple times within node_modules. I have solved it by using the So my new package.json looks something like this:
I am now going to retry using the latest ajv version, which I expect will work just as well, so long as every package uses the same installation of ajv. |
EDIT: a simpler schema
gives
SyntaxError: Unexpected token ':'
.The text was updated successfully, but these errors were encountered: