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

Case sensitivity requires all-or-nothing validation #51

Closed
ozydingo opened this issue Apr 23, 2024 · 5 comments · Fixed by #53
Closed

Case sensitivity requires all-or-nothing validation #51

ozydingo opened this issue Apr 23, 2024 · 5 comments · Fixed by #53

Comments

@ozydingo
Copy link
Contributor

ozydingo commented Apr 23, 2024

I am also running into the issue brought up in #48. Speciically, I am working with a partner whose rss feed contains

    <item>
      [...]
      <itunes:episodeType>full</itunes:episodeType>
      [...]
    </item>

This causes parse validation to fail. @kou has advised to disable validation in this case; is this possible to do on just this attribute, or is validation all-or-nothing? Suggesting clients disable all validation because of a common casing issue present in RSS feeds of well-known publishers is a bit impractical and opens the door to many validation bugs.

My ask is that:

  • How to disable validation is documented (please forgive me if it is, but I was unable to find it and simply looked in the method signatures and have landed on RSS::Parser.parse(content, validate: false))
  • Discuss the approach disabling validation of specific attributes vs global validation
  • Reconsider if casing should be considered a validation error. As @liberlanco points out, existing validators do not seem to consider this a validation error, and it is a common occurrence in publishers' feeds. I am also unable to find a technical document stating that this should be a case sensitive value; I would happily take a link to a document that does as ammo to push back on the publisher.
@kou
Copy link
Member

kou commented Apr 24, 2024

  • How to disable validation is documented

Sorry. We don't have enough documentation for it in English.

  • Discuss the approach disabling validation of specific attributes vs global validation

I think that "disabling validation of specific attributes" isn't a good approach. If we have it, users can't trust parsed result. (Invalid value may be included.)

Adding support for preparer may be a good approach. For example: RSS::Parser.parse(content, preparers: {"itunes:episodeType" => lambda {|value| value == "full" ? "Full" : value})

  • Reconsider if casing should be considered a validation error.

    I am also unable to find a technical document stating that this should be a case sensitive value; I would happily take a link to a document that does as ammo to push back on the publisher.

Could you ask Apple to clarify this? If the specification clarifies it, we can follow it.

Related pages:

@ozydingo
Copy link
Contributor Author

Adding support for preparer may be a good approach. For example: RSS::Parser.parse(content, preparers: {"itunes:episodeType" => lambda {|value| value == "full" ? "Full" : value})

That's a nice idea, flexible and easy to point at specific known issues like this one!

Could you ask Apple to clarify this? If the specification clarifies it, we can follow it.

I will try :-)

@ozydingo
Copy link
Contributor Author

I am continuing to follow up with Apple, who, as you might have expected, so far have just provided basic information about "here's how to publish a podcast" and "we can't comment on third part software".

In the meantime, more prominent publishers including Google (e.g. https://feeds.libsyn.com/419861/rss ) have rss feeds that include, for example

<itunes:episodeType>full</itunes:episodeType>

This is breaking more of our integrations with major partners as a result of upgrading from 0.28 that was included by default in Ruby 2.7. The consequence of the current code, even though we don't care about this field in our integration, is that we are unable to parse the RSS feed, and an exception is raised instead.

For the time being I will be looking into a monkey patch, as this is a major strain our existing customer. But I do implore you to consider allowing more lenient behavior, such as ignoring fields, adding custom parsers or preprocessors, or modifying this particular validation to match what is seen in the real world. As you have stated, a custom pre-processor is a pretty good solution; however do note that this is still a breaking change for folks upgrading from 0.28 / Ruby 2.7.

@ozydingo
Copy link
Contributor Author

I just got this back from Apple after sending another ping:

In review of the casing of the types specified in the itunes:episodeType tag, I can confirm our public documentation (see the guide listed farther below) refers the the types as “Full”, “Trailer”, and "Bonus”, and our own internal resources referring to the types as “full”, “trailer”, and “bonus”:
“full (default) - Specify full when you are submitting the complete content of your show.
trailer - Specify trailer when you are submitting a short promotional piece of content that represents a preview of your current show.
bonus - Specify bonus when you are submitting extra content for your show (for example, behind the scenes information or interviews with the cast) or cross-promotional content for another show”

Additionally, as mentioned, I can confirm that with the volume of RSS feeds that I’ve personally had to validate, both casings have validated.

[...]

Apple recommends using Podba.se or Cast Feed Validator to validate RSS feeds.

Therefore I believe the correct move is to follow Apple's text here and allow lowercase values.

@kou
Copy link
Member

kou commented May 25, 2024

Wow!

OK. Let's accept full/trailer/bonus too.

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

Successfully merging a pull request may close this issue.

2 participants