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

Lack of mandatory IDs on elements #4

Open
hansonwj opened this issue Jan 2, 2023 · 3 comments
Open

Lack of mandatory IDs on elements #4

hansonwj opened this issue Jan 2, 2023 · 3 comments

Comments

@hansonwj
Copy link

hansonwj commented Jan 2, 2023

It would be useful if the spec included a mandatory guid on each element, to help with maintaining data between systems.

@EdoardoTona EdoardoTona transferred this issue from international-orienteering-federation/datastandard-v3 Jan 20, 2024
@nzmangan
Copy link
Contributor

nzmangan commented Jan 30, 2024

@hansonwj

The following entities has an ID property attached to them:

Class => Id
ClassCourseAssignment => ClassId
ClassType => Id
Control => Id
Control => PunchingUnitId
Course => Id
Event => Id
Fee => Id
Map => Id
Organisation => Id
Person => Id
PersonCourseAssignment => EntryId
PersonEntry => Id
PersonResult => EntryId
PersonStart => EntryId
Service => Id
ServiceRequest => Id
SimpleCourse => Id
TeamEntry => Id
TeamMemberCourseAssignment => EntryId
TeamMemberResult => EntryId
TeamMemberStart => EntryId
TeamResult => EntryId
TeamStart => EntryId

Given the xsd the following class was generated (for c#):

namespace IOF.XML.V3 {
  [Serializable()]
  [DebuggerStepThrough()]
  [DesignerCategory("code")]
  [XmlType(Namespace = "http://www.orienteering.org/datastandard/3.0")]
  public partial class Id {
    [XmlAttribute("type")]
    public string Type { get; set; }
    [XmlText()]
    public string Value { get; set; }
  }
}

So each id property has both an value property and a type property which should hopefully be enough to allow you to attach the id required to specific entities.

@hansonwj Can you please review the list and see if anything entity is missing the requested id (array)?

In c# you should be able to write an extention method to extract the ID in a clean way...

@hansonwj
Copy link
Author

Hi @nzmangan apologies for not being clearer.

My issue is not that the Id elements don't exist in the spec, but that it is not mandatory to provide an Id in most cases. For example, in the Person element [IOF.xsd:458], the minOccurs for the Id element is set at 0

<xsd:element name="Id" type="Id" minOccurs="0" maxOccurs="unbounded">

In this scenario, if no Id is provided, you would have to use the Name and other keys to identify the Person.

If I remember correctly, I was trying to detect new PersonResult elements in live results, but the originating system did not provide a unique identifier for each PersonResult element, meaning I had to check the Id of the Person within the PersonResult instead. Not the end of the world, but also not ideal.

There must be valid reasons why Id elements are not mandatory in the spec, but I think it is worth considering if some of the elements should have mandatory Ids. Please correct me if I have misunderstood the spec.

@hansonwj hansonwj changed the title Lack of GUIDs on elements Lack of mandatory IDs on elements Jan 31, 2024
@nzmangan
Copy link
Contributor

@hansonwj

I am struggling to see what difference it would make the minimum value 1 as it would still be down to each software to implement such feature. I would not be surprised if 0% of the applications out there is not validating the generated xml against the xsd, so even if we do change this I am not sure how many application would enforce such change.

I guess in theory you can argue that you can tell the developers that they do not conform to the standard but I am not sure what leverage you would have. There is plenty of software used that are not dealing well with missing xml element / null values.
There is also a possibility that people would just generate random numbers instead which I guess is even less helpful.

I do agree with what you are trying to achieve and yes IOF should probably ensure the specs are showing best practice if IOF values your proposal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants