w3c / specberus

Checker used at W3C to validate the compliance of Technical Reports with publication rules
https://www.w3.org/pubrules/
MIT License
71 stars 44 forks source link

Support file upload from the web UI #1815

Closed jyasskin closed 2 months ago

jyasskin commented 6 months ago

I'd like to iterate on pubrules errors in a local file, but https://www.w3.org/pubrules/ expects me to have a public URL available. I can use the JS or REST API, but it'd be more convenient if there were an <input type=file> control on that page.

jyasskin commented 6 months ago

REST turns out to be less helpful than I expected: the endpoints are all GET, so there's no obvious way to send the file parameter, and no examples in https://github.com/w3c/specberus/blob/main/README.md#5-rest-api.

The JS API kinda works, but I had to figure out that I needed to import the right profile instead of just writing "WD", and the EventEmitter interface for getting results is awkward.

deniak commented 6 months ago

@jyasskin thanks for the suggestion. We actually got similar requests in the past and one of the reasons we didn't support this is that pubrules relies on external services like the markup validator. That said, we can probably come up with a different approach to support file uploads but I will need to review the different use cases. I expect I'll be able to work on this in 2 or 3 weeks.

wareid commented 3 months ago

I am currently struggling with this exact problem at the moment and I would like to +1 the need for file upload as an input option. In my particular use case, I'm not the most proficient with REST or JS APIs so I am limited to the web interface.

I'm trying to prepare a file for publication, I don't really want to have to throw this temp file into my GH repo just to test this, it would be a lot more helpful to be able to upload it to Pubrules directly.

deniak commented 2 months ago

@jyasskin @wareid, sorry it took so long to implement but it is now possible to upload an HTML file to pubrules. It can be done from the web interface or from the API.

wareid commented 2 months ago

@deniak This is amazing! Thank you so much for taking care of this.