phpfui / icalendar

Library for reading and writing iCalendar files in PHP
Other
10 stars 7 forks source link

Validator #4

Open keunes opened 1 year ago

keunes commented 1 year ago

Hello,

Via your post in the upstream repo I came across yours. I like the (web-based) validator of the original creator as it helped me with build a way to dynamically generate an ICS file for a Jekyll site (https://github.com/AntennaPod/antennapod.github.io/pull/192).

As new events get added to the site, I would love to have a way to have the validity/correctness of the ICS file checked automatically. Ideally through a GitHub action that we could run as test for each PR.

Would something like that be possible with this library? If so, I guess this is a 'feature request' (even though I realise this is in no way a feature of the PHP library). (I would fully understand if you close as won't fix.)

phpfui commented 1 year ago

I think a validator idea is a valid one! Unfortunately I don't have the bandwidth to do this. I originally found the upstream library via its website and thought it looked legitimate. It may be, but the code turned out to be old. I submitted a PR to modernize it after contacting the owner, but it was ignored. So I released my own version, as I was already using it.

There are other PHP calendar libraries out there. One may do validation, not sure. But the format is a standard, so it should be easy to switch if you want.

Of course feel free to submit a PR adding validation. If you spend the time, I will surely add it, as I think it is a great idea. I may request a few interface changes, or I might just merge and make them myself. Only up front request would be to add lots of tests, basically a directory of valid files and a directory of invalid files. Then the tests are trivial to update when you find a valid or invalid example, you just add it to the correct directory, and bingo, test added.

Let me know of any questions. Happy to lend an eye or ear.

On Sun, Nov 20, 2022, 6:36 PM Keunes @.***> wrote:

Hello,

Via your post in the upstream repo I came across yours. I like the (web-based) validator of the original creator as it helped me with build a way to dynamically generate an ICS file for a Jekyll site ( AntennaPod/antennapod.github.io#192 https://github.com/AntennaPod/antennapod.github.io/pull/192).

As new events get added to the site, I would love to have a way to have the validity/correctness of the ICS file checked automatically. Ideally through a GitHub action that we could run as test for each PR.

Would something like that be possible with this library? If so, I guess this is a 'feature request' (even though I realise this is in no way a feature of the PHP library). (I would fully understand if you close as won't fix.)

— Reply to this email directly, view it on GitHub https://github.com/phpfui/icalendar/issues/4, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYW6S7KADX2T2D3A3KPLJTWJKYW5ANCNFSM6AAAAAASGCX6DA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

keunes commented 1 year ago

Thanks for the quick & positive reply! Unfortunately don't have the skills to write a validator - I barely get by with Jekyll/Liquid and some CSS :)

I'll see if I can think of some channels to ask if there might anyone be up to the challenge.

phpfui commented 1 year ago

You might want to contact Dan Cogliano at icalendar.org. I think he wrote the original PHP library and the current validator. I seem to remember that the validator was written in Java. If so, you might be able to convince him to make it open source. I think that would be a good resource. I did a similar project with the W3C HTML Validator. They also have a Java server to validate HTML. I use it in my https://github.com/phpfui/HTMLUnitTester project. Basically you run the Java server on your machine then use its API via PHP to validate against.

Good luck in your adventure. Let me know what you come up with, as I think it would be a good addition to this library.

phpfui commented 1 year ago

Found this validator written in Java. https://repo.or.cz/ical-validator.git/bundles Has not changed in 9 years, so no idea if it still works.

keunes commented 1 year ago

Has not changed in 9 years

Then if I'm not mistaken it doesn't support the RFC 7986 standard, which is from 2016.

You might want to contact Dan Cogliano at icalendar.org

I've sent a message through their website form. Not too hopeful about a reply tbh, but let's see. Otherwise I'll keep testing the calendar files manually :)