Skip to content

Commit

Permalink
Merge pull request #347 from appwrite/fix-android-model-realtime-payload
Browse files Browse the repository at this point in the history
Add property serialised names to fix use with realtime `payloadType`
  • Loading branch information
abnegate authored Jan 28, 2022
2 parents 6ab3025 + e99618d commit 8cbd513
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %}
package {{ sdk.namespace | caseDot }}.models

import com.google.gson.annotations.SerializedName

/**
* {{ definition.description }}
*/
Expand All @@ -10,6 +12,7 @@ data class {{ definition.name | caseUcfirst }}(
* {{ property.description }}
*
*/
@SerializedName("{{ property.name | escapeKeyword | escapeDollarSign}}")
{% if property.required %}val{% else%}var{% endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{{ "\n" }}{% endif %}

{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% macro sub_schema(property) %}{% if property.sub_schema %}{% if property.type == 'array' %}List<{{property.sub_schema | caseUcfirst}}>{% else %}{{property.sub_schema | caseUcfirst}}{% endif %}{% else %}{{property.type | typeName}}{% endif %}{% endmacro %}
package {{ sdk.namespace | caseDot }}.models

import com.google.gson.annotations.SerializedName

/**
* {{ definition.description }}
*/
Expand All @@ -10,6 +12,7 @@ data class {{ definition.name | caseUcfirst }}(
* {{ property.description }}
*
*/
@SerializedName("{{ property.name | escapeKeyword | escapeDollarSign}}")
{% if property.required %}val{% else%}var{% endif %} {{ property.name | escapeKeyword | removeDollarSign }}: {{_self.sub_schema(property)}}{% if not property.required %}?{% endif %}{% if not loop.last or (loop.last and definition.additionalProperties) %},{{ "\n" }}{% endif %}

{% endfor %}
Expand Down

0 comments on commit 8cbd513

Please sign in to comment.