Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Bug (?) and/or feature request: Violations are thrown for event properties not matching the case defined in the tracking plan #272

Open
cjhensen opened this issue Nov 30, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@cjhensen
Copy link

Hello Segment team!

We have a tracking plan where we define event properties using snake_case. When using the nice-property-names: true option in typewriter.yml, a property such as account_id gets transformed to accountID. This is fine, aside from the fact that when an event is called with that property name, it will always throw a violation because it doesn't match the snake case property. Not sure if this is a bug or not.

If it's not a bug, I'd like to suggest this feature:
Add a new option to the typewriter.yml that allows for conversion of property names back to JSON. If you specify the option just-types: false, then a nice Convert class is generated in the output code. However, they can't be used in combination with the generated track functions because the types won't match up. If there was an option to convert back to JSON before the event is sent to Segment, then there wouldn't be violations in this case.

@oscb
Copy link
Contributor

oscb commented Dec 14, 2022

Hi @cjhensen

I confirmed this is happening and it is a bug. This one might be a tricky bug to fix as we the nice-property-names options comes directly from the Quicktype library we use for generating the types in each language (same for the handy conversion functions).

I agree on your solution, the right way would be to convert the classes back to JSON and then then send those. The tricky part however will be to actually map these conversions to each type, we will have to delve for a while in Quicktype's internals to find the right way to do so.

Sorry for not having a better solution, but for now I think the best is to stick to the names as they are in defined in the the tracking plan to prevent issues. For now I'm going to have to turn off the nice-property-names options while we work on a better solution.

@oscb oscb added the bug Something isn't working label Dec 14, 2022
@cjhensen
Copy link
Author

Hi @oscb! Apologies for my delay in response here. I appreciate you confirming the bug. We are going to stick with the property names as defined in the tracking plan for the time being while this bug is open. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants