Skip to content

Unable to add proto files from nested directories used in imports #1262

Description

@siewers

When I add proto definitions, the WireMockProtoFileResolver will only add the files if the filename (the first line comment in each proto file) does not contain invalid file name characters.
However, when imports contain relative paths to other proto files, it fails to find them because they are not added.

I'm testing WireMock using the OpenTelemetry proto files, but they are organized in the following directory structure, which fails to work with WireMock.
I'm manually parsing each proto file and injecting the filename as the first line comment in each file; however, it doesn't work since the filename has to match the one in the imports, and I'm not allowed to use invalid filename characters, which the forward slash (/) is.

opentelemetry
└───proto
    ├───collector
    │   │
    │   ├───metrics
    │   │   └───v1
    │   │           metrics_service.proto
    │   │
    │   ├───profiles
    │   │   └───v1development
    │   │           profiles_service.proto
    │   │
    │   └───trace
    │       └───v1
    │               trace_service.proto
    │
    ├───common
    │   └───v1
    │           common.proto
    │
    ├───metrics
    │   └───v1
    │           metrics.proto
    │
    ├───profiles
    │   └───v1development
    │           profiles.proto
    │
    ├───resource
    │   └───v1
    │           resource.proto
    │
    └───trace
        └───v1
                trace.proto

Can I make this work, or do I need to find another tool for the job?

I was thinking about creating a custom IProtoFileResolver implementation, but the WireMockProtoFileResolver is hard coded in ProtoBufMatcher.DecodeAsync, and I don't want to reimplement the entire thing as it seems like a missing feature in WireMock.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions