这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@AnnieAtHasura
Copy link
Contributor

Description

This PR is a refactor of submitValidation and it's helper, columnValidation, which had become a bit of spaghetti, and which had bug #1712
Inspecting code found several others.
I have rewritten the code to be cleaner and more uniform in structure, in the process fixing these bugs.

Affected components

  • Console

Related Issues

#1712

Solution and Design

Original code had a nest of logic to do what really is simply a series of checks.
Now simply does the checks in order.
Additionally, I have refactored the error checking to separate the error test and the
dispatch of an error so the logic is clearer.

Steps to test and verify

See steps in #1712

  1. make a table named author with these columns
    name=author type= Integer (auto increment) check unique
    name=name type=<leave default, none selected>

  2. submit -
    observe an error message instead of the server side message

Limitations, known bugs & workarounds

There is no code support for validating postgres type literals on the client side.
Rather than extend this fix to fixing this issue, I pass everything (which is current behavior),
and reported https://github.com/hasura/graphql-engine-internal/issues/199

@netlify
Copy link

netlify bot commented Jun 20, 2019

Deploy preview for hasura-docs ready!

Built with commit c39753e

https://deploy-preview-2408--hasura-docs.netlify.com

@hasura-bot
Copy link
Contributor

Review app for commit 880cabc deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-880cabc3

@rikinsk-zz rikinsk-zz added the c/console Related to console label Jun 20, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 3d037af deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-3d037af2

@hasura-bot
Copy link
Contributor

Review app for commit 2ac01b3 deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-2ac01b3d

@hasura-bot
Copy link
Contributor

Review app for commit e8ffa8c deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-e8ffa8c2

@rikinsk-zz rikinsk-zz self-requested a review June 27, 2019 12:56
@hasura-bot
Copy link
Contributor

Review app for commit 344812e deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-344812e9

@hasura-bot
Copy link
Contributor

Review app for commit 4b86882 deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-4b868828

@hasura-bot
Copy link
Contributor

Review app for commit 2c45ee8 deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-2c45ee8d

@hasura-bot
Copy link
Contributor

Review app for commit c39753e deployed to Heroku: https://hge-ci-pull-2408.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2408-c39753e7

@shahidhk shahidhk merged commit 9a6e9df into hasura:master Jul 2, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-2408.herokuapp.com is deleted

wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 3, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 4, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 8, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 12, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 23, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 24, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
wawhal added a commit to wawhal/graphql-engine that referenced this pull request Jul 24, 2019
* render 404 for nonexistent resources (hasura#2341)

* update console dev logging + add logging disable instructions to README (hasura#2388)

* update table rename handling (hasura#2393)

* suggest column default values (hasura#2352)

* fix postgres query to fetch pg_types default functions (close hasura#2399) (hasura#2402)

* add graphql-voyager to console (close hasura#314) (hasura#2369)

* clear header state for remote-schema (close hasura#2396) (hasura#2401)

* change browse rows action buttons heading id (close hasura#2403) (hasura#2413)

* created docker compose for build and launch of tutorial (hasura#2406)

* fix renaming of columns used in insert permission (fix hasura#2398) (hasura#2414)

* graphql2chartjs: fix mapping of non-array types (hasura#2307)

* add name of ci environment to telemetry data (hasura#2382)

* learn: update react native tutorial with videos (hasura#2390)

* create down migration when a column is dropped (close hasura#2291) (hasura#2385)

* add new column row during add table only after completed prev column def (hasura#2428)

* add a make rule to build server docker image locally (hasura#2410)

* learn: fix twitter share image on homepage (hasura#2437)

* add note on exporting multiple schemas as migration (hasura#2436)

* fix browse rows query error handling + boolean filter value (close hasura#2421) (hasura#2440)

* graphql2chartjs: bump version to 0.3.0 (hasura#2445)

* fix to show error notification when run sql fails in cli mode (close hasura#2438) (hasura#2446)

* freeze requirements.txt for server tests (hasura#2450)

* update postgres permission documentation (fix hasura#2404) (hasura#2405)

* refactor AddTable validation on console (close hasura#1712) (hasura#2408)

* change default type placeholder from 'text' to type (fix 2394) (hasura#2458)

* add server version to console html (close hasura#2444) (hasura#2452)

* fix type placeholders in console insert/edit row (hasura#2460)

* fix relationship page error if array fk relationship exists with table in another schema (hasura#2459)

* infer relationship type using uniqueness constraint of foreign key (close hasura#969) (hasura#2347)

* use server version from console html (hasura#2464)

* add schema explorer ui

* wire up create API, WIP

* ui fixes

* integrate with proxy API

* fetch remote relationships in loadSchema

* fixes

* finish up UI for remote rels; waiting on edit API

* break relationships ui into sections

* move graphql schema to local state

* update relationship label

* restructure

* update styles; add tooltips

* filter out fields (scalar type || wrapped scalar type) and do accept any args

* remove an unnecessary log

* version check init

* add version check for remote relationship on loadSchema

* use FT_REMOTE_RELATIONSHIPS

* allow adding string values for scalar args

* comment code

* add update relationship feature

* cover edge cases for update remote rel

* fix semver issue where sometimes the query would never be called

* remove unnecessary fields from schema tree

* stable

* wip

* wip

* wip

* add version checks

* invalidate remote schema cache appropriately

* Remove unnecessary logs
polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/console Related to console

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants