question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support adding default values to generated schema

See original GitHub issue

@dstelljes I’m creating this issue based on your comment on #7

Since default values aren’t accessible via reflection, maybe an easier way to implement this functionality would be via an annotation? Something to the effect of

public class Message
{
  [AvroDefaultValue(null)]
  public int? Property { get; set; } = null;
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
polanski-piotrcommented, Oct 26, 2021

@dstelljes Hey, I have suggestion.

Since our event models contains domain models, the Kafka related attributes on domain model will create tight coupling to our infrastructure (Avro schema builder in this case) and this usually not a good thing.

Maybe instead of attributes on model we should add some configuration options to schema builder, something like

eventModelSchemaBuilder.Create<SomeEventModel>()
  .MakeOptional(em => em.Something.Inside.Model)
  .MakeOptional(em => em.SomethingElse.Inside.Model)
.Build()
0reactions
dstelljescommented, Feb 11, 2022

Support for the [DefaultValue] attribute is released with 8.0.0-pre.1.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add default values from JSON schema ...
I need to validate a JSON document AND add default values defined in the schema if the values are missing in the given...
Read more >
Specify default column values | BigQuery
Set default values ​​ You can set the default value for columns when you create a new table. You use the CREATE TABLE...
Read more >
Resource schema-based support for static default values
Add resource schema-based support for static default values to the framework. This default value handling would occur during the PlanResourceChange RPC and ...
Read more >
How Does a Schema Support Default Fields or NULL Fields?
To enable the schema generated based on the JSON data sample supports the default value or null, select the Convert and Move and...
Read more >
Setting default values in the schema of a component in a Job
You can set default values in the schema of certain components to replace null values retrieved from the data source.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found