What is the casing followed in API, Is that a snak...
# community-help
s
What is the casing followed in API, Is that a snake case or Camel casing? I am looking at dotnet client code and its using camel casing but the docs shows snake case
j
The Typesense API itself uses snake_case for API params. So the client might be translating from camel case to snake case before sending to Typesense. CC: @Rune Nielsen who authored the dot net client
r
@satish venkatakrishnan It uses camelCase by default, but you can override it on the document classes you want to insert into Typesense, here is an example:
Copy code
[JsonPropertyName("house_number")]
public int HouseNumber { get; set; }
So you can set the names to whatever you like. 🙂 You could also do something weird like:
Copy code
[JsonPropertyName("hOuse_NumBer")]
public int HouseNumber { get; set; }
Full class example using snake_case:
Copy code
public class Address
{
    [JsonPropertyName("id")]
    public string Id { get; set; }
    [JsonPropertyName("house_number")]
    public int HouseNumber { get; set; }
    [JsonPropertyName("access_address")]
    public string AccessAddress { get; set; }
    [JsonPropertyName("metadata_notes")]
    public string MetadataNotes { get; set; }
}
Also all API params are translated to snake_case if you use the default implementation shown in the docs, example doing a search.
Copy code
var query = new SearchParameters("Smed", "access_address");
var searchResult = await typesenseClient.Search<Address>("Addresses", query);
s
Thanks @Rune Nielsen.