feathers
feathers copied to clipboard
Extending authentication config section causes ajv compile error
Steps to reproduce
I want to extend the authentication.oauth
config section with a custom strategy.
However, the code errors with:
/Users/jamesholcomb/code/app/node_modules/ajv/lib/compile/util.ts:211
if (mode === true) throw new Error(msg)
^
Error: strict mode: default is ignored for: data10.header
at checkStrictMode (/Users/jamesholcomb/code/jaunt/node_modules/ajv/lib/compile/util.ts:211:28)
I could not find any examples or documentation, so I am flying blind with the approach.
Also, TS complains with TS2589 on the line calling getValidator
Type instantiation is excessively deep and possibly infinite.ts(2589)
⚠ Error(TS2589) |
Type instantiation is excessively deep and possibly infinite.
This was asked on Discord as well:
https://discord.com/channels/509848480760725514/930352418179391528/1103802794223358013
import {
Type,
getValidator,
defaultAppConfiguration
} from "@feathersjs/typebox"
import type { Static } from "@feathersjs/typebox"
import { dataValidator } from "./validators"
export const configurationSchema = Type.Intersect(
[
defaultAppConfiguration,
Type.Object({
authentication: Type.Object({
oauth: Type.Object({
xyz: Type.Object({
key: Type.String(),
secret: Type.String(),
scope: Type.Array(Type.String())
})
})
}),
})
],
)
export type ApplicationConfiguration = Static<typeof configurationSchema>
export const configurationValidator = getValidator(
configurationSchema,
dataValidator
)
Expected behavior
Type compiles
Actual behavior
Error: strict mode: default is ignored for: data10.header
System configuration
feathers 5.0.5
System:
OS: macOS 12.6.6
CPU: (10) arm64 Apple M1 Max
Memory: 98.28 MB / 32.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9477386
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
Languages:
Java: 11.0.17 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
tsconfig.json
{
"compilerOptions": {
"rootDir": "./",
"baseUrl": "./",
"sourceRoot": "src",
"allowJs": true,
"checkJs": true,
"outDir": "./dist",
"sourceMap": true,
"skipLibCheck": true,
"module": "commonjs",
"target": "es2021",
"moduleResolution": "node",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"noImplicitThis": true,
"types": ["node", "mocha"],
"typeRoots": ["./node_modules/@types", "./types"],
"paths": {
"~/*": ["./src/*"],
"@test/*": ["./test/*"]
}
},
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
},
"swc": true,
"require": ["tsconfig-paths/register"]
//"esm": true
},
"lib": ["es2021"],
"include": [
"src/**/*",
"config/*.json",
"data/**/*.csv",
"data/**/*.txt",
"test/**/*"
],
"exclude": ["node_modules", ".vscode", "dist", "coverage", "migrations"]
}