Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Aug 16 13:55

    jeremydmiller on master

    Minor clean up of the Telehealt… bumping to alpha-5, using C# 10… (compare)

  • Aug 16 09:40
    dnfadmin commented #2149
  • Aug 16 09:40
    dnfadmin commented #2149
  • Aug 15 12:45
    dnfadmin commented #1544
  • Aug 15 12:45
    dnfadmin commented #1544
  • Aug 14 21:44
    jeremydmiller closed #533
  • Aug 14 21:44
    jeremydmiller commented #533
  • Aug 14 21:44
    jeremydmiller labeled #533
  • Aug 14 21:43
    jeremydmiller commented #555
  • Aug 14 21:43
    jeremydmiller closed #555
  • Aug 14 21:43
    jeremydmiller closed #597
  • Aug 14 21:43
    jeremydmiller commented #597
  • Aug 14 21:43
    jeremydmiller labeled #597
  • Aug 14 21:43
    jeremydmiller unlabeled #597
  • Aug 14 21:40
    jeremydmiller commented #554
  • Aug 14 21:38
    jeremydmiller edited #554
  • Aug 14 21:38
    jeremydmiller edited #554
  • Aug 14 21:27
    jeremydmiller commented #740
  • Aug 14 21:23
    jeremydmiller closed #743
  • Aug 14 21:23
    jeremydmiller closed #717
Tony Karalis
@tonykaralis
Very interesting :thumbsup:
Oskar Dudycz
@oskardudycz
As for now you could try to implement your own wrapper
that eg. you'd store json schema somewhere
and then verify if the documents are valid for eg. most recent schema
So write some kind of "contract tests"
To have simple implementation dedicated for your need shouldn't be super hard
Especially if it's run for the tests and to eg. validate if your core changes didn't break anything
then it should be imho fine solution
Tony Karalis
@tonykaralis
I am using Martens subtyping as well though. I have about 15 classes going into a single table.
Absolutely, at the moment any change in order to get to production would require approval and all tests to pass. So at least a junior wont wreck it accidentally. So putting your solution into a test would add that extra check. ;)
Oskar Dudycz
@oskardudycz
Understood
so I think that maintaining the json schema
and then validating it should wokr
I had similar tests in my previous project, I stored snapshoted sample jsons
and then made sure that they're valid in the new schema, and all is working fine
I used that to make sure that I didn't provide a breaking change in my contracts
Tony Karalis
@tonykaralis
Out of interest, what would you do when they werent valid? Lets say you added a property which in my case would be fine, the test still fails?
Oskar Dudycz
@oskardudycz
I think that it would be nice to have built-in feature related to that in the Marten, but because of our capacity that probably happen soon
That depeneds, normally adding property is not a breaking change until it's not required
or if it's required than it has default value, so the flow will continue to work
Rename, or removing the property without doing fallback would be for me breaking change
Tony Karalis
@tonykaralis
So upon validating the json schema, it would allow the addition of properties through
Oskar Dudycz
@oskardudycz
In my case - yes
although it depends of the exact schema change
Tony Karalis
@tonykaralis
Got ya
Did you ever encounter a breaking change? So your schema check test failed but you ended up having to keep the breaking change
Oskar Dudycz
@oskardudycz
If you're adding new property then to make old documents work then you need to provide some kind of fallback or migration. Fallback is eg. the default value or some logic if the data is not filled.
I think that it's safer and in the long term faster to not make breaking changes
But sometimes it happens
so there might be various solutions for that
Tony Karalis
@tonykaralis
I hear you
Oskar Dudycz
@oskardudycz
  1. The easiest is to publish prerelease package with the breaking change so the package clients might be prepared and then when all confirm that they have the code prepared then release the package.
  1. Longer, but better. Send at first non-breaking change so the new payload together with the old one and try to handle both. You mark also old one as obsolete. Then you can have "contract" with the clients of your package (especially if they're other teams in your company) that they have eg. 2-4 weeks to adapt, then you'll remove the old payload.
at least that's the scenarios that I'd suggest
Tony Karalis
@tonykaralis
Thank you Oscar, i think I like this one the most >I think that it's safer and in the long term faster to not make breaking changes
Oskar Dudycz
@oskardudycz
Plus it's always good to provide some explanation or migration guide if this is the breaking change
In Marten, we're also trying to avoid breaking changes as much as we can
Tony Karalis
@tonykaralis
I have noticed, trust me its much appreciated.
Oskar Dudycz
@oskardudycz
There is third option, so you provide new implementation as the feature toggle that someone might turn on or of
so eg. class in the new namespace
and then also give some time for users to adapt
But it's more for the contract changes in eg. Rest or events
probably for the packages it won't be super effective, but it's also an option
Then after some time you just remove the old code and remove this feature toggle
Tony Karalis
@tonykaralis
I had never thought of using a different namespace that way, nice one ;)
Oskar Dudycz
@oskardudycz
:+1:
Tony Karalis
@tonykaralis
Just thought of a quick and dirty way of checking the schemas. What if we used a bit of reflection and stored a list of property names and types, then just did a check for any missing properties(which would imply a delete/rename) or any type changes.
We could then register all the classes we want to check (I don't need everything validated, only the ones in the external core library)
Might be a dud, whats your first impression?
Oskar Dudycz
@oskardudycz
That's also an option, but you'd also need to store imho types of properties