cyberphone / cbor-everywhere

CBOR Information Resources
Apache License 2.0
11 stars 2 forks source link

How to do 'contract first' #1

Open kuehne-trustable-de opened 1 year ago

kuehne-trustable-de commented 1 year ago

To leave the XML & JSON worlds I wonder how to apply a 'contract first' approach. What's the best way to describe an interface?

cyberphone commented 1 year ago

This is one solution: https://www.rfc-editor.org/rfc/rfc8610.html

I'm aware of the problem, so I opened this issue: https://github.com/OAI/OpenAPI-Specification/issues/3108

cyberphone commented 1 year ago
Since numeric labels are preferable due to element positioning and size, I ended up with the following method: Name Label Type Description
someParameter 1 tstr Keeps some very useful text
anotherOne 2 bstr Probably quite useful as well

Sample:

{
  1: "Rock and Roll will never die",
  2: h'aabb78'
}

Using the Name as labels, the elements would (due to deterministic coding rules), be swapped which may not be what you wanted.

cyberphone commented 1 year ago

For a fairly complex encryption container I added this to the tables: encryption