stoplightio / http-spec

Utilities to normalize OpenAPI v2 and v3 objects for the Stoplight ecosystem.
https://stoplight.io
Apache License 2.0
20 stars 12 forks source link

fix: add translate callback support #211

Closed brendarearden closed 1 year ago

brendarearden commented 1 year ago

Motivation and Context

callbacks can use a runtime expression as their path value, when we translate the path in http-spec we sanitize it so, for example, '{$request.body#/newPetAvailableUrl}' & '{$request.body#/returnedPetAvailableUrl}' become {} & {} and are now identical and are given the same identifier which is resulting in issues when attempting to get nodes by id

see issue getting node by id here: #15026

Description

Added a new context, callback, to identify when a callback is being translated. If it is a callback, do not sanitize the path. Added tests to cover generateIds for httpOperation and httpCallbackOperation Added a test for callback translation

Types of changes

Checklist

stoplight-bot commented 1 year ago

:tada: This PR is included in version 5.5.4 :tada:

The release is available on:

Your semantic-release bot :package::rocket: