-
-
Notifications
You must be signed in to change notification settings - Fork 753
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
Additional AJV-formats crash app #2960
Comments
It looks like these formats are only available in the ajv-formats pre-release and not in the officially published version which is used here. You can use this version by adding the prerelease to your project:
And then changing import { Ajv, addFormats } from '@feathersjs/schema' To import { Ajv } from '@feathersjs/schema'
import addFormats from 'ajv-formats' |
Thanks for the help |
UP (@daffl) The ajv-formats package haven't been updated since more than 2 years, we still have to force ajv to 3.0.0-rc to prevent issues with iso-date-time Shouldn't feathers update ajv package to prevent this issue on future users? Whats the news about it? kind regards, |
This is an issue with the ajv-formats package. ajv-validator/ajv-formats#75 has the discussion on what would be necessary to get the latest version published. |
Thanks a lot for the related issue! |
Following the Documentation for Additional Types and adding any of the 'additional' types (such as
iso-date-time
) tovalidators.ts
, typescript complains thatiso-date-time
is not a valid option. Furthermore, using those types in a schema causes the app to crash.Steps to reproduce
npx @feathersjs/cli@pre generate app
accept all defaultsEdit
validators.ts
by adding'iso-date-time'
to the list of formats (have to add//@ts-ignore
forts-node
to not complain)Edit
users.schema.ts
to add an attributecreatedAt: Type.String({ format: 'iso-date-time' })
Run
yarn dev
App Crashes
Repro
Looking at
@feathersjs/schema
it specifies[email protected]
, which looking at that version,iso-date-time
is not included in that version. It is however included in[email protected]
which their (ajv-formats) readme references.So as far as I can tell, the feathers documentation references some options for the release candidate
ajv-formats
package but that is not the package references in@feathersjs/schema
'spackage.json
.If I'm missing some step that I should have done to make this work then I apologize
Expected behavior
Should be able to enable that additional options in
validators.ts
that are shown in the documentationActual behavior
The app crashes with the message
unknown format "iso-date-time" ignored in schema at path "#/properties/modules/items/properties/createdAt"
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working):
NodeJS version:
16.15.1
Operating System:
OSX 12.6.1
Browser Version:
React Native Version:
Module Loader:
The text was updated successfully, but these errors were encountered: