fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
MIT License
2.45k stars 118 forks source link

fix: validate files to be uploaded #3872

Closed trevorblades closed 1 week ago

trevorblades commented 2 weeks ago

This PR is part one of two, ensuring that only files of specific types are uploaded to our system. This does file upload validation on the client side, but we must also implement some server-side validation.

Fixes FER-2070

trevorblades commented 2 weeks ago

@trevorblades thoughts on adding this to the docs-validation package (link)?

This way when a user runs fern check they will get a validation error that will automatically notify them that they can't upload those specific files.

That's a good idea! I can do that. Does the docs validator run before docs publishing, and would its failure stop a publish command? What I'm getting at is if you see this as something that lives in the docs validator and here in the publish command, or just in the validator.

dsinghvi commented 2 weeks ago

@trevorblades thoughts on adding this to the docs-validation package (link)? This way when a user runs fern check they will get a validation error that will automatically notify them that they can't upload those specific files.

That's a good idea! I can do that. Does the docs validator run before docs publishing, and would its failure stop a publish command? What I'm getting at is if you see this as something that lives in the docs validator and here in the publish command, or just in the validator.

Just in the validator works! the validator runs and has to be passed in order to hit publish

trevorblades commented 1 week ago

@dsinghvi I moved the file type check to the validator CLI and added some tests to confirm it's working as expected. Lmk if that looks like what you had in mind!