Enumeration handling #92
Replies: 10 comments
-
That's cool. Interesting, I was not aware of that. I wonder how many other types are both enumerations and classes. That sounds like a bug. In this case, we should add a suffix to the enumeration or class, and then generate both enum and class types. We use two JSON-LD files downloaded from schema.org to drive the creation of all the types. Given time, I'd look in there to see how |
Beta Was this translation helpful? Give feedback.
-
Interesting! Maybe a bug... We should raise it with the schema.org folks over at that repo if so? Couldn’t find anything about it in their issues, but you might find something I missed? Suffix would break implementations like ours that rely on the predictability of names to generate subclasses automatically - perhaps we could use .NET namespaces to keep enums separate and allow them to be predictably referenced? The IDE would then help users with this too? Look forward to hearing your findings |
Beta Was this translation helpful? Give feedback.
-
The link to the two JSON-LD files can be found in the schema generating Tool project. I would check in there first. It may be a bug with schema.org or it could be our code not handling it. Namespaces is another way to go. Not sure what I'd choose yet. I'd want to know how often this happens before I decided. |
Beta Was this translation helpful? Give feedback.
-
Oh I see, it's definitely coming from schema.org (PaymentMethod subclasses Enumeration, FinancialProduct subclasses Service):
Looks like this "Enumeration is also a Class" issues applies to:
So there are quite a few in there... if this isn't something you're aware of perhaps we raise it with the schema.org mailing list / GitHub? |
Beta Was this translation helpful? Give feedback.
-
You could ask them to make sure but I'm assuming having an enum and class with the same name is allowed by schema.org. When you say there are quite a few, how many? |
Beta Was this translation helpful? Give feedback.
-
23 that seem to have properties according to the GUI - however: https://schema.org/DrugClass shows that even a straightforward “Enumeration” can be used as a class, without subclassing anything except Enumeration... so not sure whether it would be correct to assume that this applies to all Enumerations? Perhaps this is where we need guidance? |
Beta Was this translation helpful? Give feedback.
-
It might be worth asking them how we should handle this scenario after explaining what Schema.NET has achieved. I'm not certain what the best resolution is at the moment. |
Beta Was this translation helpful? Give feedback.
-
Hey @RehanSaeed just to let you know I've reached out to the schema.org mailing list on this question. For now we're going to implement the following (which seems to match what Schema.NET already does):
If they come back with anything on the mailing list (specifically around https://schema.org/PaymentCard) we can pick it up then and perhaps discuss how to approach across both projects? |
Beta Was this translation helpful? Give feedback.
-
I'd raise an issue on their GitHub too. They do have a lot of open issues and I imagine that they are having a hard time keeping up but I've always got a response from the maintainers. |
Beta Was this translation helpful? Give feedback.
-
Please feel free to open a bug once you have some answers. |
Beta Was this translation helpful? Give feedback.
-
Hi @RehanSaeed! We're porting Schema.NET to PHP and Ruby, and were wondering if you could help us out with a question we had on enumeration handling...
https://schema.org/PaymentCard is both an https://schema.org/Enumeration and a https://schema.org/Service, and in Schema.NET it is treated only as an enum without a corresponding class.
We're really interested in the logic you're applying here and the rationale for it?
Beta Was this translation helpful? Give feedback.
All reactions