Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
{% for struct in types.all.implementing.Codable|struct %}
{% ifnot struct.annotations.ignore %}
extension {{ struct.name }} {
enum CodingKeys: String, CodingKey {
{% for var in struct.storedVariables %}
{% if var.annotations.key %}
case {{ var.name }} = "{{ var.annotations.key }}"
{% endif %}
{% ifnot var.annotations.key %}
case {{ var.name }}
{% endif %}
{% endfor %}
}
}
{% endif %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment