Looking for suggestions on how to deprecate fields...
# pactflow-ama
e
Looking for suggestions on how to deprecate fields in API / Provider Contract in Pactflow BDCT scenario. Our FE app installs our API OAS and uses it to create request handlers for API, and we also use this installed OAS in FE with openapi-backend library to mock responses for MSW/pact-msw-adapter. We are now looking to remove some fields from the API OAS, and have already stopped FE app from using them. Trouble is, the current OAS schema used for mock generation and consequently for pact-msw-adapter still has those fields, and the resulting Consumer Contract expects them to be present in OAS (Provider Contract). This means that a PR on the API OAS to remove these fields fails verification. Does anyone have any experience with handling this?
🙌 1
m
we also use this installed OAS in FE with openapi-backend library to mock responses
I think that’s your problem. The consumer should reduce the number of fields expected in the mock, but if you’re using the supplied OAS as the source of the mocks you’re always going to get stuck in this loop. Can the consumer not modify the mocks for their specific needs?
e
thanks Matt, this helped clear up my understanding of the problem 👍 we're now running mock server with mocks created on Consumer side specifically for each endpoint and are able to deprecate Provider fields
🙌 1
m
Great, glad it helped!