Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add message style guide to API style guide. (#76)

spinningbotdeda7400c5a8
diff --git a/docs/api-style-guide.md b/docs/api-style-guide.md
index f8838bf4d5..b19bdcd923 100644
--- a/docs/api-style-guide.md
+++ b/docs/api-style-guide.md
@@ -36,6 +36,18 @@ _Note_: We do aware this is different from the common convention. However, we ar
If the resource supports batch operation, then use a separate `/batch` endpoint under that resource.
+# Messages
+
+## Property Name Convension
+
+We use json messages to communicate between backend and frontend following [Google JSON Style Guide](https://google.github.io/styleguide/jsoncstyleguide.xml). Property names must be camelCased, ascii strings. Variable names in different languages should follow their own language styles, e.g. Go and Vue. However, we must use json annotation for every fields in Go API structs to enforce the same style on the wire and prevent any breaking changes by refactoring because Go will set the json property name based on field name automatically.
+
+We can look at the following example as an interesting case. helloID follows Go style while the wired message use helloId to be consistent with Vue convension.
+
+1. Go struct field: ``` helloID string `json:"helloId"` ```.
+1. Json property name: ``` helloId ```.
+1. Vue template name: ``` helloId ``` => ``` hello-id ```.
+
# References
1. [Google's AIP](https://google.aip.dev/)