Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Check bool examples, don't crash on nonexistent examples. #58

Merged
merged 6 commits into from
Aug 13, 2021

Conversation

Oberon00
Copy link
Member

@Oberon00 Oberon00 commented Aug 3, 2021

We don't run into this in the spec yet, but if we ever want to remove some integer examples, we will.

@Oberon00 Oberon00 added bug Something isn't working semconv Related to the semantic convention generator. semconv/model Related to the data model or YAML format of the semantic convention generator labels Aug 3, 2021
@Oberon00 Oberon00 requested a review from thisthat as a code owner August 3, 2021 15:48
@Oberon00 Oberon00 requested a review from a team August 3, 2021 15:48
position = attribute.lc.data[list(attribute)[0]]
msg = "Empty examples for {} are not allowed".format(attr_type)
raise ValidationError.from_yaml_pos(position, msg)
if is_simple_type and attr_type not in ["boolean", "boolean[]"]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thisthat Any idea why this was originally excluded? To support more boolean values like "yes" instead of "true"?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we excluded boolean attributes from having an example because it is not very useful to have true/false there.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know they are not required to have examples (though before this patch, non-array bools without examples would have crashed the generator). But in case they do have examples (which is allowed), the examples should still be checked for whether they have the right type.

…attribute.py

Co-authored-by: Mario Jonke <mario.jonke@dynatrace.com>
…attribute.py

Co-authored-by: Armin Ruech <armin.ruech@dynatrace.com>
@arminru arminru merged commit 620fcc4 into open-telemetry:main Aug 13, 2021
@arminru arminru deleted the examplefix branch August 13, 2021 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semconv/model Related to the data model or YAML format of the semantic convention generator semconv Related to the semantic convention generator.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants