Repository metrics
- Stars
- (216 stars)
- PR merge metrics
- (PR metrics pending)
Description
The "required" field of the spec accepts 5 different values. They're not documented very prominently (#496 ), but there's a definition for them here:
Current enforcement
Looking through the code, I found some places that make use of them:
-
Deprecated elements (
-1) issue errors: -
Elements that must have exactly
1or must have at least one+issue errors:https://github.com/ignitionrobotics/sdformat/blob/12e77821af7c2810c4d9d532ee8cb833cbb8e318/src/parser.cc#L1504-L1509 https://github.com/ignitionrobotics/sdformat/blob/12e77821af7c2810c4d9d532ee8cb833cbb8e318/src/parser.cc#L1903
But that 's only part of it.
Missing enforcement
Should these also cause errors (they're all currently valid according to ign sdf -k)?
More than one element when it should have exactly one (1):
<?xml version="1.0" ?>
<sdf version="1.6">
<world name="banana">
<audio>
<device>a</device>
<device>b</device>
</audio>
</world>
</sdf>
The difference between 0 and * should be clarified in the documentation and also in the enforcement. I assume that the existence of * implies that 0 means "either none or one". In that case, this should be an error:
<?xml version="1.0" ?>
<sdf version="1.6">
<world name="banana">
<wind></wind>
<wind></wind>
</world>
</sdf>