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

Validate JS function logic before publishing #483

Closed
roshaans opened this issue Jan 3, 2024 · 1 comment
Closed

Validate JS function logic before publishing #483

roshaans opened this issue Jan 3, 2024 · 1 comment
Labels

Comments

@roshaans
Copy link
Contributor

roshaans commented Jan 3, 2024

At the moment, we allow users to publish invalid code to the registry.

We should validate the JS code in the editor alongside the current schema validation before publishing code.

This should prevent users from making unnecessary and wrong changes to their indexer.

@roshaans roshaans added the bug Something isn't working label Jan 3, 2024
@jl-santana
Copy link
Contributor

Additionally, we want to improve the schema validation logic too before publishing, More info on this thread

@jl-santana jl-santana added enhancement New feature or request and removed bug Something isn't working labels Jan 8, 2024
jl-santana added a commit that referenced this issue Jan 11, 2024
More info about this can be found on this
[issue](#483)

Changes on this PR:
- Validate code & schema before registering the indexer
Logic: If formatting either the code or the schema fails, the `Publish`
button is disabled. Only if type generation errors or no errors are
detected, the `Publish` button will be enabled. More about this on this
[discussion](#480 (comment))


https://github.com/near/queryapi/assets/15988846/68f89cb4-f561-4e8a-9fa7-81c1a38e548c

Additionally 
- Created a reusable Modal with a global context to manage it, so we can
trigger it from any component to display some info
- Updated schema with granular error types for improved clarity
- Created a custom error class to filter by type Error. We can add more
fields on it if needed

---------

Co-authored-by: Juan Luis Santana <[email protected]>
Co-authored-by: Roshaan Siddiqui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants