https://linen.dev logo
#help
Title
# help
m

Mahi Vasi

06/21/2023, 4:17 AM
Hello! I have a question regarding usage of Jackson views defined in Core PrivateView and PublicView specifically for persistence of stub mappings on filesystem. Is there a way to inject config so id and uuid are not persisted along with stubmapping on file system and leverage Views defined already. We are using wiremock in a shared environment where team will develop mocks locally and will push to a remote git rep, where they will be served over a remote wiremock instance. While doing this, noticed that wiremock persists ids/uuids locally and dont want collision of ids and hence looking for a way to have them as transient.
t

Tom

06/21/2023, 10:12 AM
Hi @Mahi Vasi you can write stub JSON files to the mappings directory without IDs and although they get populated in memory when read, they’re not automatically written back to the filesystem, so this may be a solution. If you needed to customise this behaviour at the moment you’d need to write a custom
MappingsStore
implementation with your own serialisation logic.
m

Mahi Vasi

06/21/2023, 1:05 PM
Thanks Tom, After looking into code am thinking i can achieve this by customizing objectmapper with a mixin. I see i can tap into Json.getObjectMapper and configure a mixin for stubmapping. Are there any callbacks or listener support available at wiremock startup to fine tune objectmapper. Let me know your thoughts. Appreciate you looking into this.
t

Tom

06/21/2023, 2:25 PM
There aren’t unfortunately. The
Json
class is a bit inflexible in that sense. You’re probably better off creating your own
ObjectMapper
and the using that from within your own
MappingsStore