We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I expect the following code to print the schema w/ a default value per the avro spec.
default
const userAvroSchema = Type.forSchema({ type: 'record', name: 'User', fields: [ { name: 'id', type: 'int' }, { name: 'name', type: 'string' }, { name: 'email', type: 'string' }, { name: 'newValue', type: 'string', default: 'somevalue' }, { name: 'registeredAt', type: { type: 'long', logicalType: 'timestamp-millis' }, }, ], }); console.log(JSON.stringify(userAvroSchema.schema()));
Prints:
{"name":"User","type":"record","fields":[{"name":"id","type":"int"},{"name":"name","type":"string"},{"name":"email","type":"string"},{"name":"newValue","type":"string"},{"name":"registeredAt","type":"long"}]}
Is this something I'm doing wrong or is this a bug in the library?
The text was updated successfully, but these errors were encountered:
Passing {exportAttrs: true} will include the defaults. Found a reference to it here: https://github.com/mtth/avsc/blob/master/etc/scripts/infer#L72
{exportAttrs: true}
Sorry, something went wrong.
schema without any arguments returns the type's canonical schema, which doesn't include defaults.
schema
No branches or pull requests
I expect the following code to print the schema w/ a
default
value per the avro spec.Prints:
Is this something I'm doing wrong or is this a bug in the library?
The text was updated successfully, but these errors were encountered: