Are mappings subdirectories supported in wiremock?

Viewed 587

I am trying to put mappings json files in a subdirectories due to different requirements based on diff profiles.

I have it working with default /mappings directory and all mappings work ok in postman.

WiremockConfiguration options = options()
.usingFilesUnderDirectory(System.getPtoperty(“user.dir”) + “/app/src/main/resources”

src/main/resources

-mappings

—folderA

—folderB

—folderC

But once I try to place json files under sub directory of “mappings” folder, no mappings get picked up and /__admin/mappings endpoint show a total of 0.

WiremockConfiguration options = options()
.usingFilesUnderDirectory(System.getPtoperty(“user.dir”) + “/app/src/main/resources**/mappings/aws**”

(Note the path difference)

I am just wondering if mappings folder subdirectories are even supported in wire mock or have I configured something incorrectly? It seems something too simple to be not supported by wiremock!

Many thanks

2 Answers

I have fixed it but for anyone facing similar problem u need to make “mappings” subdirectory of your custom folders.

src/main/resources

-my_wiremock_mappings

—folderA

—— mappings (should contain json files)

—folderB

—— mappings

—folderC

—— mappings

WiremockConfiguration options = options()
.usingFilesUnderDirectory(System.getPtoperty(“user.dir”) + “/app/src/main/resources/my_wiremock_mappings/folderA”

There is no need to add “mappings” to the path.

Related