-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
feat: standalone mode #460
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I understand, we need this when we want to generate stringify function for schemas that we know before runtime.
-
IMHO, it's better to create util that will use fjs to create such modules. I don't really like that one function can return a function or code of a module depending on the params.
-
Can't we create these stringify functions in the runtime? We need to do it only once. I don't think it will affect performance significantly and, more importantly, we won't have to make sure we recompile the module after we fix something in fjs.
If I missed something, please tell me.
We always can do it.
I think it will affect cold start time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@climba03003 @mcollina I was writing a long description of why it's not the best solution. Partially my fault, I should have requested changes, probably. The question is what can we do with it now? This solution brings a dependency on internal code structure/names. It will block a lot of optimizations that will not support function serialization. The first thing that will not work that I found is ajv schema validation because we use uuids when inserting a schema and then we will regenerate them. Line 621 in 310325b
|
These are very serious changes, that would take a lot of effort to maintain. I guess we can fix the Fastify issue easier right now. Can we do something with it and then think deeply about what to do with this idea? |
I think we focus on fixing the Of course, we can provide a truely |
@climba03003 can you just rebuild error schema serializer using the last fjs version that did it correctly? |
I agree this is a reasonable approach, but creating a new API is serious. We can't just deprecate it if we find a better solution. We will have to support it. |
Yes, it is. Can we add a experimental flag to indicate the user do not use it in code at this moment or it may break somehow. |
The original refactoring should not have shipped as they broke an important use case for Fastify. I'm happy to remove this flag in a semver-major change (if it's the only change) and update Fastify accordingly. |
debugMode
inmode
option.standalone
mode which people can create the code that can directly require and runfastify
standalone error serializer build #459Checklist
npm run test
andnpm run benchmark
and the Code of conduct