cbor / cbor.github.io

cbor.io web site
75 stars 33 forks source link

Does Cbor support schema evolution? #40

Open kant111 opened 6 years ago

kant111 commented 6 years ago

Can a writer and reader have different schema ?

ii8 commented 6 years ago

yes.

If the writer has this CDDL schema:

something = {
  member: bool,
  member2: uint
}

and the reader has one like this

something = {
  member: bool
}

then the reading implementation can access member without issue. There may be caveats depending on the implementation, for example if your decoder checks that the incoming data contains nothing extra to what is defined in the scheme then naturally this wont work. And other common sense stuff like indices in arrays can't change etc.