buvinghausen / Swashbuckle.NodaTime.AspNetCore

Easily configure Swashbuckle to generate correct documentation for NodaTime types.
MIT License
3 stars 7 forks source link

Use a fixed instant for Schemas.fs to make output deterministic #3

Closed larsiver closed 2 years ago

larsiver commented 3 years ago

I use this package in an auto test to generate a swagger document that is then compared against a committed version of a document. If the documents do not match, the test fails, and I have to make an informed decision on whether the change was intentional or accidental and modify code as appropriate.

To be true, I use a forked version, because in Schemas.fs the timestamp used in examples is SystemClock.Instance.GetCurrentInstant(). That means that generated swagger documents are not deterministic. If this is changed to some fixed instant like Instant.FromUnixTimeTicks(15759724104663180L), I wouldn't need the fork.

petriashev commented 3 years ago

Generate swagger with user provided samples possible with alternative package https://www.nuget.org/packages/MicroElements.Swashbuckle.NodaTime/ Also there is option omit sample generation

Sorry for advertising :) I can delete this message

buvinghausen commented 2 years ago

@larsiver sorry for the late response I wound up breaking my tibia, fibula, femur, and pelvis shortly after your request. Anyways this change has been reflected in the latest release which is now pending indexing and verification at Nuget.

larsiver commented 2 years ago

Nice, works like a charm.