mbari-org / annosaurus

Service for storing and retrieving video/image annotations from VARS
https://docs.mbari.org/annosaurus/
Apache License 2.0
1 stars 1 forks source link

Verify that schemas for this version and production version exactly match #33

Closed hohonuuli closed 8 months ago

hohonuuli commented 8 months ago
### Tasks
hohonuuli commented 8 months ago

I adde the following to help drop nulls/None from the generated JSON:

extension [T: Encoder](value: T) def stringify: String = Encoder[T].apply(value)
        .deepDropNullValues
        .stringify
hohonuuli commented 8 months ago

In order to get nulls dropped from the JSON output, I did the following:

1. Create the Printer in CirceCodecs.scala:

val CustomPrinter: Printer = Printer(
    dropNullValues = true,
     indent = ""
)

2. Override TapirJsonCirce. I did this in Endpoints.scala

object CustomTapirJsonCirce extends TapirJsonCirce:
    override def jsonPrinter: Printer = CirceCodecs.CustomPrinter

3. Import the custom printer.

In each endpoints class, comment out tapir's default implementation and import my custom one

//import sttp.tapir.json.circe.*
import CustomTapirJsonCirce.*
hohonuuli commented 8 months ago

Probably the best way to do this is to add integration tests to mbari-org/vars-annotation as a starting point

hohonuuli commented 8 months ago

See mbari-org/vars-annotation#169

hohonuuli commented 8 months ago

There are some minor changes, but I've updated the next (pending) release of vars-annotation to handle them. I will have to coordinate with @kevinsbarnard to run tests with vars-gridview.