Repository navigation
How do I add a field or a method to the v2 contract? #611
|
I need one more field in a v2 response, and maybe a new method. What do I edit, what do I regenerate, and which checks will hold me to the rules? |
Replies: 1 comment
|
Edit the proto. Regenerate. Keep the resource map and the mirror tests level with the proto. The contract grows by addition only.
The checks do not catch everything: only review catches a change of meaning under the same name. A new requirement on a request that old clients send is breaking, and ships together with a raised minimum client version, never alone. A truly breaking change becomes More: https://github.com/lumenpearson/lessons/blob/main/docs/api.md#changing-it and https://github.com/lumenpearson/lessons/blob/main/docs/build.md#the-v2-contract-and-buf |
Edit the proto. Regenerate. Keep the resource map and the mirror tests level with the proto. The contract grows by addition only.
A field: add the field in its service's file under
proto/lessons/v2/, under a new number.v1: Schema.field).deprecatedfirst. Remove it, with its number and namereserved, only once no client above the minimum version reads it.A method: add the method to its service with:
google.api.httprule under/v2/…: standard verbs, orPOST …:verbfor anything else;(lessons.v2.auth), and(lessons.v2.min_role)i…