What is the best practice for version control of Thrift files (api)?

I have an API written with care. Example:

service Api {
  void invoke()
}

He is doing something. I want to change the behavior to do something else, but still maintain the same behavior for customers who expect old behavior.

What is the best practice for handling a new version of the API?

+4
source share
2 answers

Soft performance

Thrift supports soft versioning, so version 2 of your service is perfectly true, which looks like this:

service Api {
   void invoke(1: string optional_arg1, 2: i32 optional_arg2) throws (1: MyError e)
   i32 number_of_invokes()
}

, (, arg1, arg2). , - .

, , ( ) .

, .. IDL , .

struct foobar {
  // API 1.0 fields
  1: i32 foo
  //2: i32 bar   - obsolete with API 2.0

  // API 2.0 fields
  3: i32 baz
}

required

, required. API , required, , . required . , , required, , , .

optional , Thrift ( ) . , required .

Endpoints

, - , - . , API , , . .

, , Thrift 0.9.2, / (, socket, http URI,...)

+4

( ), . invoke . invoke, - (, ), , . , .

0

Source: https://habr.com/ru/post/1570011/


All Articles