stoplightio / prism

Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.
https://stoplight.io/open-source/prism
Apache License 2.0
4.34k stars 349 forks source link

Path collision: Static vs dynamic route conflict in OpenAPI spec #2619

Open JuicyLung91 opened 1 month ago

JuicyLung91 commented 1 month ago

Hi Prism team,

We're encountering a routing issue with Prism where it can't distinguish between two similar paths:

/contracts/{contract_id}/items/{item_id}/{reference_date} — reference_date is an integer (e.g., year as 20230729). /contracts/{contract_id}/items/{item_id}/notes — notes is a static string. The problem is that Prism interprets "notes" as a value for reference_date, always matching the first path and returns a 422 with an error reference_date must be integer

Question: Is there a way to configure Prism to handle static segments (like /notes) correctly, so they aren't treated as dynamic parameters? Or do we need to modify our OpenAPI spec to avoid this conflict?

Thanks for your help!

JuicyLung91 commented 3 weeks ago

It seems like it is already fixed in v5. My docker compose uses the v4. Is it true that it has already been fixed? Sorry for the confusion.

Can be closed.