James Murphy
03/06/2024, 7:40 AMJames Murphy
03/06/2024, 7:45 AMBoris
03/06/2024, 10:05 AMopenapi.json
a schema thing? Because schemas aren't contracts, so you'd lot be missing coverage and reasoning power.James Murphy
03/06/2024, 10:18 AMBoris
03/06/2024, 10:26 AMBoris
03/06/2024, 10:28 AMJames Murphy
03/06/2024, 12:30 PMJames Murphy
03/06/2024, 12:30 PMJames Murphy
03/06/2024, 12:31 PMJames Murphy
03/06/2024, 12:32 PMJames Murphy
03/06/2024, 12:32 PMJames Murphy
03/06/2024, 12:32 PMMatt (pactflow.io / pact-js / pact-go)
Boris
03/07/2024, 12:24 AMYousaf Nabi (pactflow.io)
you can guarantee to never introduce breaking changes (ie you follow semver.. any new MAJOR version results in a new URL (/my-api/v1, /my-api/v2)..You now have to maintain individual endpints
are used to generate the stubs/codeYou donât know exactly which fields a consumer needs to perform its function, so you have to assume your entire surface area of your api is in use all the time (which is rank)
i would say semantic versioning and guaranteeing never to introduce breaking changes (if you do, thats a new URL) combined with openapi as the definition of a contractThat is alot of onus on your developers, plus all you ensure if you never remove fields, leading to bloated responses or you have two versioned apis which is also nasty
you are able to release new APIs without breaking consumers, you can monitor logs (watch for the User-Agent field to work out who the consumer is... ie which service is the consumer that is still using the old version - so you know who to talk to)a user agent can only tell you who called what endpoint, not what they need from that endpoint plus you can only check this post deployment, pact affords you this pre-deployment
and the testing is done using a client generated from the openapi.json (so as so as a field is changed in the openapi.json, if that field also isnt changed in the implementation then the tests fail and it cant be deployed)Yes but a client may never use any of the fields (they may only use one) - adding an extra field shouldnât break your client, if they donât use it. Removing a field, will cause the client team to realise they canât perform what they need to, and then they have to discuss it with the provider team
Yousaf Nabi (pactflow.io)
optic is used to guarantee the openapi.json does not change in a breaking way without a major version incrementThis will force you into bumping your versions when in reality no-one might be using that field and therefore you can safely remove without a major version bump
Yousaf Nabi (pactflow.io)
You didnât really answer the question, but if you have some way of guaranteeing those things, then I think you probably donât need Pact? Iâm not aware of any tooling or systems that do, so itâd be great if you could share some đThis is a good point. If you have other mechanisms that provide you confidence, fair enough, but that doesnât discount other mechanisms.
There is little to no benefit in using pact. with openapi.json as the source of truth, and a tool like optic which is able to compare the current openapi.json with the previous openapi.jsonI completely disagree, Pact will provide you field level visibility pre-deployment and allow you to make better decisions about your versioning strategy for your providing api, hopefully mitigating the requirement to maintain multiple code paths
Yousaf Nabi (pactflow.io)
James Murphy
03/07/2024, 12:12 PMThat is alot of onus on your developers, plus all you ensure if you never remove fields, leading to bloated responsesactually: they do remove fields.. the reason you can guaranteeing never to introduce breaking change is due to the tooling because you are made aware of breaking changes, and forced to increment MAJOR - which also brings with it a new URL (major version number are also in the URL - so that people have to explicitly upgrade to the next breaking version) - you never break any existing client so this is covered in 2 ways: 1. optic reports on breaking changes as visible in the openapi.json files 2. .net package validation reports on breaking change as visible in all public classes, methods, properties, etc so you are forced to follow semantic versioning every single time. there is no exception, there is nothing to consider.. you dont need to wonder if someone is using that field and only increment the major version number when someone is (that would appear inconsistent to people outside your team.. when you delete a field, sometimes you increment the major version and sometimes you dont?) .. you follow the same way of incrementing version numbers all the time and you dont really need to think about it
Removing a field, will cause the client team to realise they canât perform what they need to, and then they have to discuss it with the provider teami think the only time anyone talks with anyone else is: when as a provider you have a previous major version still running because consumer ABC still hasnt migrated to the latest major version.. this is one thing im really struggling with: why do consumers dictate what a provider can do and cause some changes a provider tries to make as not possible?? you're the provider (one), there could be hundreds of consumers - if you want to remove a field from your code, your api, and you're fine to continue keeping the previous major version running to allow people to upgrade - consumers shouldnt have any say in that / how you do that.. yes, i get it: if you just go and remove a field out of the blue, you will break consumers.. in this instance where someone isn't following semantic versioning and is not keeping the previous major version running while people migrate: pact makes sense..
James Murphy
03/07/2024, 12:13 PMJames Murphy
03/07/2024, 12:17 PMAugmenting it with a full Pact provider verification, whereby the contracts are replayed against your provider (pre deployment) affords you the strongest guaranteesif you know for a fact that your endpoint will always work for a particular set of fields/etc (because if it doesnt: that update is pushed to a new URL version), this isnt needed, is it? the consumers have confidence in the fact they will not break
Yousaf Nabi (pactflow.io)
seperate-ish question: can you be in a situation where a consumer application that hasnt had a change to it in 4 years but as a provider you believe they are still using field XYZ (because pact is telling you).. before removing XYZ, you try and get in touch with that consumer to discover the team no longer exists, the app is no longer running anywhere in your environment and youâve just gone on a wild goose chase? (edited)Theoretically yes. The broker isnât aware about the states of your application, beyond what you tell it. The onus would be on the consumer team, to record-release-ended or record-undeployment of their application from an environment and at minimum delete associated pacts from their main branch. If the team creating the pacts disbands, and the application is removed from an env, the above should be adhered to.
Yousaf Nabi (pactflow.io)
Yousaf Nabi (pactflow.io)