-
Notifications
You must be signed in to change notification settings - Fork 84
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
Add register_schemas
option to encode
method
#210
Conversation
context, _subject = parse_qualified_subject(params[:subject]) | ||
schema_id = SCHEMAS[context].index(schema) |
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.
This was already fixed in the parent but was failing here so all I did was copy the same behavior
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.
Generally looks good, but I think we should use a different name for the argument!
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.
🥳
read_only
option to encode
methodregister_schemas
option to encode
method
Hi!
I would like to add the possibility to not register a new schema when encoding a message and passing the
schema_name
option only.The motivation for this is that most of the times the schema evolution (registering and updates) are done during the Continuous Delivery process (during deployments, right before putting the new application code live), since this process is very delicate and we do not want to risk accidentally evolving the schema when trying things out in the development phase, I think it's important to have the option to tell the library to use a
register_schemas
false mode while encoding.In my company, currently the applications do not have to keep track of the current
schema_id
or even theversion
of the schemas used. So generally we call the encode method with the following options:The problem with this is that, if by any chance we're testing things out locally, there is a risk to trigger an evolution of the schema by registering a new version that was not ready to be evolved.
In order to avoid that, we want to provide the
register_schemas
option, which only in case of false checks if the schema is already registered (by using the existingcheck
action) and caches the schema so that it's only checked once, if it exists, it returns theschema_id
from there instead of attempting to register it.This change is 100% backwards compatible, as the current behavior only changes if the user decides to pass the
register_schemas
option set to false.